| java.lang.Object gnu.bytecode.Type
All known Subclasses: gnu.bytecode.ObjectType, gnu.bytecode.PrimType,
Type | abstract public class Type (Code) | | |
Method Summary | |
abstract public Object | coerceFromObject(Object obj) Convert an object to a value of this Type.
Throw a ClassCastException when this is not possible. | public Object | coerceToObject(Object obj) | abstract public 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.
"Same member" is rather loose; by "A is a subtype of B"
we mean that all instance of A can be "widened" to B.
More formally, A.compare(B) returns:
1: all B values can be converted to A without a coercion failure
(i.e. | public void | emitCoerceFrom(Type fromType, CodeAttr code) Compile code to convert an object (on the stack) of that Type
to this Type. | public void | emitCoerceFromObject(CodeAttr code) Compile code to coerce/convert from Object to this type. | public void | emitCoerceTo(Type toType, CodeAttr code) Compile code to convert an object (on the stack) of this Type
to toType. | public void | emitCoerceToObject(CodeAttr code) Compile code to convert a object of this type on the stack to Object. | public void | emitIsInstance(CodeAttr code) | public static void | flushTypeChanges() | public static void | free(java.util.Map t) | public static Type | fullSignatureToType(String sig, int[] offset) Get a Type corresponding to the given full signature string
starting from offset[0]. | public Type | getImplementationType() The type used to implement types not natively understood by the JVM.
Usually, the identity function. | static java.util.Hashtable | getMapNameToType() | public String | getName() | public java.lang.Class | getReflectClass() Get the java.lang.Class object for the representation type. | final public String | getSignature() | final public int | getSize() | public static Type | getType(String name) Find an Type with the given name, or create a new one.
Use this for "library classes", where you need the field/method types,
but not one where you are about to generate code for.
Parameters: name - the name of the class (e..g. | public boolean | isArray() | abstract public boolean | isAssignableTo(Type other) | public boolean | isInstance(Object obj) | public static boolean | isMoreSpecific(Type[] t1, Type[] t2) Return true iff t1[i].isSubtype(t2[i]) for all i. | public boolean | isSubtype(Type other) Return true if this is a "subtype" of other. | public static boolean | isValidJavaTypeName(String name) | final public boolean | isVoid() | public static Type | lookupType(String name) | public static Type | lowestCommonSuperType(Type t1, Type t2) Computes the common supertype
Interfaces are not taken into account. | public static Type | make(Class reflectClass) | public Type | promote() | Method | refineMethod(Method method) Return an equivalent method when the receiver is of this type. | public static void | registerTypeForClass(Class clas, Type type) Register that the Type for class is type. | public static void | registerTypeForName(String name, Type type) Register that the Type for class is type. | public static void | reset() | protected void | setSignature(String sig) | public static int | signatureLength(String sig, int pos) Return the length of the signature starting at a given string position.
Returns -1 for an invalid signature. | public static int | signatureLength(String sig) | public static String | signatureToName(String sig) Returns the Java-level type name from a given signature.
Returns null for an invalid signature. | public static PrimType | signatureToPrimitive(char sig) Returns the primitive type corresponding to a signature character.
a primitive type, or null if there is no such type. | public static Type | signatureToType(String sig, int off, int len) Get a Type corresponding to the given signature string. | public static Type | signatureToType(String sig) Get a Type corresponding to the given signature string. | protected static int | swappedCompareResult(int code) Change result from compare to compensate for argument swapping. | public String | toString() |
booleanValue_method | public static Method booleanValue_method(Code) | | |
collectable | public boolean collectable(Code) | | |
doubleValue_method | public static Method doubleValue_method(Code) | | |
floatValue_method | public static Method floatValue_method(Code) | | |
mapNameToType | static java.util.Hashtable mapNameToType(Code) | | Maps Java type name (e.g. "java.lang.String[]") to corresponding Type.
|
neverReturnsType | final public static PrimType neverReturnsType(Code) | | The "return type" of an expression that never returns, e.g. a throw.
|
size | int size(Code) | | Nominal unpromoted size in bytes.
|
coerceFromObject | abstract public Object coerceFromObject(Object obj)(Code) | | Convert an object to a value of this Type.
Throw a ClassCastException when this is not possible.
|
compare | abstract public int compare(Type other)(Code) | | 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.
"Same member" is rather loose; by "A is a subtype of B"
we mean that all instance of A can be "widened" to B.
More formally, A.compare(B) returns:
1: all B values can be converted to A without a coercion failure
(i.e. a ClassCastException or overflow or major loss of information),
but not vice versa.
0: all A values can be converted to B without a coercion failure
and vice versa;
-1: all A values can be converted to B without a coercion failure
not not vice versa;
-2: there are (potentially) some A values that can be converted to B,
and some B values can be converted to A;
-3: there are no A values that can be converted to B, and neither
are there any B values that can be converted to A.
|
emitCoerceFrom | public void emitCoerceFrom(Type fromType, CodeAttr code)(Code) | | Compile code to convert an object (on the stack) of that Type
to this Type.
|
emitCoerceFromObject | public void emitCoerceFromObject(CodeAttr code)(Code) | | Compile code to coerce/convert from Object to this type.
|
emitCoerceTo | public void emitCoerceTo(Type toType, CodeAttr code)(Code) | | Compile code to convert an object (on the stack) of this Type
to toType.
|
emitCoerceToObject | public void emitCoerceToObject(CodeAttr code)(Code) | | Compile code to convert a object of this type on the stack to Object.
|
flushTypeChanges | public static void flushTypeChanges()(Code) | | |
fullSignatureToType | public static Type fullSignatureToType(String sig, int[] offset)(Code) | | Get a Type corresponding to the given full signature string
starting from offset[0].
Set offset[0] to the end index of the signature.
|
getImplementationType | public Type getImplementationType()(Code) | | The type used to implement types not natively understood by the JVM.
Usually, the identity function. However, a language might handle
union types or template types or type expression scalculated at
run time. In that case return the type used at the JVM level,
and known at compile time.
|
getReflectClass | public java.lang.Class getReflectClass()(Code) | | Get the java.lang.Class object for the representation type.
|
getSize | final public int getSize()(Code) | | |
getType | public static Type getType(String name)(Code) | | Find an Type with the given name, or create a new one.
Use this for "library classes", where you need the field/method types,
but not one where you are about to generate code for.
Parameters: name - the name of the class (e..g. "java.lang.String"). |
isArray | public boolean isArray()(Code) | | |
isAssignableTo | abstract public boolean isAssignableTo(Type other)(Code) | | true if values of this type can be assigned to otherwithout widening nor conversion. |
isMoreSpecific | public static boolean isMoreSpecific(Type[] t1, Type[] t2)(Code) | | Return true iff t1[i].isSubtype(t2[i]) for all i.
|
isSubtype | public boolean isSubtype(Type other)(Code) | | Return true if this is a "subtype" of other.
|
isValidJavaTypeName | public static boolean isValidJavaTypeName(String name)(Code) | | |
isVoid | final public boolean isVoid()(Code) | | |
lowestCommonSuperType | public static Type lowestCommonSuperType(Type t1, Type t2)(Code) | | Computes the common supertype
Interfaces are not taken into account.
This would be difficult, since interfaces allow multiple-inheritance.
This means that there may exists multiple common supertypes
to t1 and t2 that are not comparable.
the lowest type that is both above t1 and t2,or null if t1 and t2 have no common supertype. |
refineMethod | Method refineMethod(Method method)(Code) | | Return an equivalent method when the receiver is of this type.
Return null if no more precise method exists.
|
registerTypeForClass | public static void registerTypeForClass(Class clas, Type type)(Code) | | Register that the Type for class is type.
|
registerTypeForName | public static void registerTypeForName(String name, Type type)(Code) | | Register that the Type for class is type.
|
reset | public static void reset()(Code) | | |
signatureLength | public static int signatureLength(String sig, int pos)(Code) | | Return the length of the signature starting at a given string position.
Returns -1 for an invalid signature.
|
signatureLength | public static int signatureLength(String sig)(Code) | | |
signatureToName | public static String signatureToName(String sig)(Code) | | Returns the Java-level type name from a given signature.
Returns null for an invalid signature.
|
signatureToPrimitive | public static PrimType signatureToPrimitive(char sig)(Code) | | Returns the primitive type corresponding to a signature character.
a primitive type, or null if there is no such type. |
signatureToType | public static Type signatureToType(String sig, int off, int len)(Code) | | Get a Type corresponding to the given signature string.
|
signatureToType | public static Type signatureToType(String sig)(Code) | | Get a Type corresponding to the given signature string.
|
swappedCompareResult | protected static int swappedCompareResult(int code)(Code) | | Change result from compare to compensate for argument swapping.
|
|
|