public abstract class Type
extends java.lang.Object
implements java.lang.reflect.Type
Modifier and Type | Class and Description |
---|---|
static class |
Type.NeverReturns
A marker class, used for
Type.neverReturnsType . |
Modifier | Constructor and Description |
---|---|
protected |
Type() |
|
Type(Type type) |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.Object |
coerceFromObject(java.lang.Object obj)
Convert an object to a value of this Type.
|
java.lang.Object |
coerceToObject(java.lang.Object obj)
Given a raw JVM value convert it to an object of this type.
|
abstract int |
compare(Type other)
Return a numeric code showing "subtype" relationship:
1: if other is a pure subtype of this;
0: if has the same values;
-1: if this is a pure subtype of other;
-2: if they have values in common but neither is a subtype of the other;
-3: if the types have no values in common.
|
void |
emitCoerceFromObject(CodeAttr code)
Compile code to coerce/convert from Object to this type.
|
void |
emitCoerceToObject(CodeAttr code)
Compile code to convert a object of this type on the stack to Object.
|
void |
emitConvertFromPrimitive(Type stackType,
CodeAttr code)
Convert from stackType (usually PrimType) to this type.
|
void |
emitIsInstance(CodeAttr code) |
java.lang.String |
getGenericSignature() |
Type |
getImplementationType()
Return Java-level implementation type.
|
java.lang.String |
getMaybeGenericSignature() |
java.lang.String |
getName() |
Type |
getRawType()
Return JVM-level implementation type.
|
Type |
getRealType()
If this is a type alias, get the aliased type.
|
java.lang.Class |
getReflectClass()
Get the java.lang.Class object for the representation type.
|
java.lang.String |
getSignature() |
int |
getSize() |
int |
getSizeInWords() |
static Type |
getType(java.lang.String name)
Find an Type with the given name, or create a new one.
|
int |
hashCode() |
int |
isCompatibleWithValue(Type valueType)
If this is the target type, is a given source type compatible?
|
static int |
isCompatibleWithValue(Type targetType,
Type valueType) |
boolean |
isExisting() |
boolean |
isInstance(java.lang.Object obj) |
boolean |
isInterface() |
static boolean |
isMoreSpecific(Type[] t1,
Type[] t2)
Return true iff t1[i].isSubtype(t2[i]) for all i.
|
static boolean |
isSame(Type t1,
Type t2) |
boolean |
isSubtype(Type other)
Return true if this is a "subtype" of other.
|
static boolean |
isValidJavaTypeName(java.lang.String name) |
boolean |
isVoid() |
static Type |
lookupType(java.lang.String name) |
static Type |
lowestCommonSharedType(Type t1,
Type t2) |
static Type |
lowestCommonSuperType(Type t1,
Type t2)
Computes the common supertype
Interfaces are not taken into account.
|
static Type |
make(java.lang.Class reflectClass) |
static Type |
make(java.lang.Class reflectClass,
java.lang.reflect.Type type)
Try to map java.lang.reflect.Type to gnu.bytecode.Type.
|
static void |
printSignature(java.lang.String sig,
int off,
int len,
java.io.PrintWriter out) |
Type |
promote() |
Type |
promoteIfUnsigned() |
static void |
registerTypeForClass(java.lang.Class clas,
Type type)
Register that the Type for class is type.
|
protected void |
setGenericSignature(java.lang.String sig) |
protected void |
setName(java.lang.String name) |
void |
setReflectClass(java.lang.Class rclass) |
protected void |
setSignature(java.lang.String sig) |
static int |
signatureLength(java.lang.String sig) |
static int |
signatureLength(java.lang.String sig,
int pos)
Return the length of the signature starting at a given string position.
|
static java.lang.String |
signatureToName(java.lang.String sig)
Returns the Java-level type name from a given signature.
|
static PrimType |
signatureToPrimitive(char sig)
Returns the primitive type corresponding to a signature character.
|
static Type |
signatureToType(java.lang.String sig)
Get a Type corresponding to the given signature string.
|
static Type |
signatureToType(java.lang.String sig,
int off,
int len)
Get a Type corresponding to the given signature string.
|
protected static int |
swappedCompareResult(int code)
Change result from compare to compensate for argument swapping.
|
java.lang.String |
toString() |
public static final PrimType byteType
public static final PrimType shortType
public static final PrimType intType
public static final PrimType longType
public static final PrimType floatType
public static final PrimType doubleType
public static final PrimType booleanType
public static final PrimType charType
public static final PrimType voidType
public static final PrimType byte_type
public static final PrimType short_type
public static final PrimType int_type
public static final PrimType long_type
public static final PrimType float_type
public static final PrimType double_type
public static final PrimType boolean_type
public static final PrimType char_type
public static final PrimType void_type
public static final Type neverReturnsType
public static final ClassType javalangObjectType
public static final ClassType objectType
public static final ClassType javalangBooleanType
public static final ClassType javalangCharacterType
public static final ClassType javalangThrowableType
public static final ClassType javalangannotationAnnotationType
public static final Type[] typeArray0
public static final Method toString_method
public static final ClassType javalangNumberType
public static final Method clone_method
public static final Method intValue_method
public static final Method longValue_method
public static final Method floatValue_method
public static final Method doubleValue_method
public static final Method booleanValue_method
public static final ClassType javalangClassType
public static final ClassType javalanginvokeMethodHandleType
public static final ObjectType nullType
public static final ObjectType errorType
public static ClassType javalangStringType
public static final ObjectType toStringType
@Deprecated public static final ClassType pointer_type
@Deprecated public static final ClassType string_type
@Deprecated public static final ObjectType tostring_type
@Deprecated public static final ClassType java_lang_Class_type
@Deprecated public static final ClassType boolean_ctype
public static final ClassType throwable_type
@Deprecated public static final ClassType number_type
protected java.lang.Class reflectClass
protected Type()
public Type(Type type)
public Type getImplementationType()
public Type getRawType()
public Type getRealType()
public boolean isInterface()
public boolean isExisting()
public static Type lookupType(java.lang.String name)
public static Type getType(java.lang.String name)
name
- the name of the class (e..g. "java.lang.String").public static void registerTypeForClass(java.lang.Class clas, Type type)
public static Type make(java.lang.Class reflectClass, java.lang.reflect.Type type)
public static Type make(java.lang.Class reflectClass)
public java.lang.String getSignature()
protected void setSignature(java.lang.String sig)
public java.lang.String getGenericSignature()
protected void setGenericSignature(java.lang.String sig)
public java.lang.String getMaybeGenericSignature()
public Type promote()
public Type promoteIfUnsigned()
public final int getSize()
public int getSizeInWords()
public final boolean isVoid()
public static PrimType signatureToPrimitive(char sig)
public static Type signatureToType(java.lang.String sig, int off, int len)
public static Type signatureToType(java.lang.String sig)
public static void printSignature(java.lang.String sig, int off, int len, java.io.PrintWriter out)
public static int signatureLength(java.lang.String sig, int pos)
public static int signatureLength(java.lang.String sig)
public static java.lang.String signatureToName(java.lang.String sig)
public java.lang.String getName()
protected void setName(java.lang.String name)
public static boolean isValidJavaTypeName(java.lang.String name)
public boolean isInstance(java.lang.Object obj)
public final boolean isSubtype(Type other)
public int isCompatibleWithValue(Type valueType)
public static Type lowestCommonSuperType(Type t1, Type t2)
public abstract int compare(Type other)
protected static int swappedCompareResult(int code)
public static boolean isMoreSpecific(Type[] t1, Type[] t2)
public void emitIsInstance(CodeAttr code)
public abstract java.lang.Object coerceFromObject(java.lang.Object obj)
public java.lang.Object coerceToObject(java.lang.Object obj)
getRawType()
, boxed as needed. The result may be
a language-specific (boxed) value. Generally a no-op.public void emitConvertFromPrimitive(Type stackType, CodeAttr code)
stackType.emitConvertFromObject
to convert the rest,
but that might throw an exception. (This is a bit of a kludge.)public void emitCoerceToObject(CodeAttr code)
public void emitCoerceFromObject(CodeAttr code)
public java.lang.Class getReflectClass()
public void setReflectClass(java.lang.Class rclass)
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object