本文整理汇总了Java中com.sun.tools.javac.code.Type.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Type.toString方法的具体用法?Java Type.toString怎么用?Java Type.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.code.Type
的用法示例。
在下文中一共展示了Type.toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeNestedType
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
private SrcType makeNestedType( Type type )
{
String fqn = type.toString();
Type enclosingType = type.getEnclosingType();
SrcType srcType;
if( enclosingType != null && !(enclosingType instanceof NoType) && fqn.length() > enclosingType.toString().length() )
{
String simpleName = fqn.substring( enclosingType.toString().length() + 1 );
srcType = new SrcType( simpleName );
srcType.setEnclosingType( makeNestedType( enclosingType ) );
}
else
{
srcType = new SrcType( fqn );
}
return srcType;
}
示例2: getExpectedName
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
String getExpectedName(VarSymbol v, int i) {
// special cases:
// synthetic method
if (((v.owner.owner.flags() & Flags.ENUM) != 0)
&& v.owner.name.toString().equals("valueOf"))
return "name";
// interfaces don't have saved names
// -- no Code attribute for the LocalVariableTable attribute
if ((v.owner.owner.flags() & Flags.INTERFACE) != 0)
return "arg" + (i - 1);
// abstract methods don't have saved names
// -- no Code attribute for the LocalVariableTable attribute
if ((v.owner.flags() & Flags.ABSTRACT) != 0)
return "arg" + (i - 1);
// bridge methods use argN. No LVT for them anymore
if ((v.owner.flags() & Flags.BRIDGE) != 0)
return "arg" + (i - 1);
// The rest of this method assumes the local conventions in the test program
Type t = v.type;
String s;
if (t.hasTag(TypeTag.CLASS))
s = ((ClassType) t).tsym.name.toString();
else
s = t.toString();
return String.valueOf(Character.toLowerCase(s.charAt(0))) + i;
}
示例3: jniType
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
@SuppressWarnings("fallthrough")
protected final String jniType(Type t) {
switch (t.getKind()) {
case ARRAY: {
Type ct = ((Type.ArrayType)t).getComponentType();
switch (ct.getKind()) {
case BOOLEAN: return "jbooleanArray";
case BYTE: return "jbyteArray";
case CHAR: return "jcharArray";
case SHORT: return "jshortArray";
case INT: return "jintArray";
case LONG: return "jlongArray";
case FLOAT: return "jfloatArray";
case DOUBLE: return "jdoubleArray";
case ARRAY:
case DECLARED: return "jobjectArray";
default: throw new Error(ct.toString());
}
}
case VOID: return "void";
case BOOLEAN: return "jboolean";
case BYTE: return "jbyte";
case CHAR: return "jchar";
case SHORT: return "jshort";
case INT: return "jint";
case LONG: return "jlong";
case FLOAT: return "jfloat";
case DOUBLE: return "jdouble";
case DECLARED: {
if (t.tsym.type == syms.stringType) {
return "jstring";
} else if (types.isAssignable(t, syms.throwableType)) {
return "jthrowable";
} else if (types.isAssignable(t, syms.classType)) {
return "jclass";
} else {
return "jobject";
}
}
}
Assert.check(false, "jni unknown type");
return null; /* dead code. */
}