public final class Type extends java.lang.Object implements TypeBearer, java.lang.Comparable<Type>
==.| Modifier and Type | Field and Description |
|---|---|
static Type |
ANNOTATION
non-null; instance representing
java.lang.annotation.Annotation |
static Type |
BOOLEAN
non-null; instance representing boolean |
static Type |
BOOLEAN_ARRAY
non-null; instance representing boolean[] |
static Type |
BOOLEAN_CLASS
non-null; instance representing java.lang.Boolean; the
suffix on the name helps disambiguate this from the instance
representing a primitive type |
static int |
BT_ADDR
basic type constant for a return address
|
static int |
BT_BOOLEAN
basic type constant for
boolean |
static int |
BT_BYTE
basic type constant for
byte |
static int |
BT_CHAR
basic type constant for
char |
static int |
BT_COUNT
count of basic type constants
|
static int |
BT_DOUBLE
basic type constant for
double |
static int |
BT_FLOAT
basic type constant for
float |
static int |
BT_INT
basic type constant for
int |
static int |
BT_LONG
basic type constant for
long |
static int |
BT_OBJECT
basic type constant for
Object |
static int |
BT_SHORT
basic type constant for
short |
static int |
BT_VOID
basic type constant for
void |
static Type |
BYTE
non-null; instance representing byte |
static Type |
BYTE_ARRAY
non-null; instance representing byte[] |
static Type |
BYTE_CLASS
non-null; instance representing java.lang.Byte; the
suffix on the name helps disambiguate this from the instance
representing a primitive type |
static Type |
CHAR
non-null; instance representing char |
static Type |
CHAR_ARRAY
non-null; instance representing char[] |
static Type |
CHARACTER_CLASS
non-null; instance representing java.lang.Character; the
suffix on the name helps disambiguate this from the instance
representing a primitive type |
static Type |
CLASS
non-null; instance representing java.lang.Class |
static Type |
CLONEABLE
non-null; instance representing java.lang.Cloneable |
static Type |
DOUBLE
non-null; instance representing double |
static Type |
DOUBLE_ARRAY
non-null; instance representing double[] |
static Type |
DOUBLE_CLASS
non-null; instance representing java.lang.Double; the
suffix on the name helps disambiguate this from the instance
representing a primitive type |
static Type |
FLOAT
non-null; instance representing float |
static Type |
FLOAT_ARRAY
non-null; instance representing float[] |
static Type |
FLOAT_CLASS
non-null; instance representing java.lang.Float; the
suffix on the name helps disambiguate this from the instance
representing a primitive type |
static Type |
INT
non-null; instance representing int |
static Type |
INT_ARRAY
non-null; instance representing int[] |
static Type |
INTEGER_CLASS
non-null; instance representing java.lang.Integer; the
suffix on the name helps disambiguate this from the instance
representing a primitive type |
static Type |
KNOWN_NULL
non-null; instance representing a known-null |
static Type |
LONG
non-null; instance representing long |
static Type |
LONG_ARRAY
non-null; instance representing long[] |
static Type |
LONG_CLASS
non-null; instance representing java.lang.Long; the
suffix on the name helps disambiguate this from the instance
representing a primitive type |
static Type |
METHOD_HANDLE
non-null; instance representing java.lang.invoke.MethodHandle |
static Type |
METHOD_TYPE
non-null; instance representing java.lang.invoke.MethodType |
static Type |
OBJECT
non-null; instance representing java.lang.Object |
static Type |
OBJECT_ARRAY
non-null; instance representing Object[] |
static Type |
RETURN_ADDRESS
non-null; instance representing a subroutine return address |
static Type |
SERIALIZABLE
non-null; instance representing java.io.Serializable |
static Type |
SHORT
non-null; instance representing short |
static Type |
SHORT_ARRAY
non-null; instance representing short[] |
static Type |
SHORT_CLASS
non-null; instance representing java.lang.Short; the
suffix on the name helps disambiguate this from the instance
representing a primitive type |
static Type |
STRING
non-null; instance representing java.lang.String |
static Type |
THROWABLE
non-null; instance representing java.lang.Throwable |
static Type |
VAR_HANDLE
non-null; instance representing java.lang.invoke.VarHandle |
static Type |
VOID
non-null; instance representing void |
static Type |
VOID_CLASS
non-null; instance representing java.lang.Void; the
suffix on the name helps disambiguate this from the instance
representing a primitive type |
| Modifier and Type | Method and Description |
|---|---|
Type |
asUninitialized(int newAt)
Returns a new interned instance which is identical to this one, except
it is indicated as uninitialized and allocated at the given bytecode
index.
|
static void |
clearInternTable() |
int |
compareTo(Type other) |
boolean |
equals(java.lang.Object other) |
Type |
getArrayType()
Gets the type corresponding to an array of this type.
|
int |
getBasicFrameType()
Gets the basic type corresponding to this instance's frame type.
|
int |
getBasicType()
Gets the basic type corresponding to this instance.
|
int |
getCategory()
Gets the category.
|
java.lang.String |
getClassName()
Gets the name of the class this type corresponds to, in internal
form.
|
Type |
getComponentType()
Gets the component type of this type.
|
java.lang.String |
getDescriptor()
Gets the descriptor.
|
Type |
getFrameType()
Gets the frame type corresponding to this type.
|
Type |
getInitializedType()
Gets the initialized type corresponding to this instance, but only
if this instance is in fact an uninitialized object type.
|
int |
getNewAt()
Gets the bytecode index at which this uninitialized type was
allocated.
|
Type |
getType()
Gets the type associated with this instance.
|
int |
hashCode() |
static Type |
intern(java.lang.String descriptor)
Returns the unique instance corresponding to the type with the
given descriptor.
|
static Type |
internClassName(java.lang.String name)
Returns the unique instance corresponding to the type of the
class with the given name.
|
static Type |
internReturnType(java.lang.String descriptor)
Returns the unique instance corresponding to the type with the
given descriptor, allowing
"V" to return the type
for void. |
boolean |
isArray()
Gets whether this type is an array type.
|
boolean |
isArrayOrKnownNull()
Gets whether this type is an array type or is a known-null, and
hence is compatible with array types.
|
boolean |
isCategory1()
Returns whether or not this is a category 1 type.
|
boolean |
isCategory2()
Returns whether or not this is a category 2 type.
|
boolean |
isConstant()
Returns whether this instance represents a constant value.
|
boolean |
isIntlike()
Gets whether this type is "intlike." An intlike type is one which, when
placed on a stack or in a local, is automatically converted to an
int. |
boolean |
isPrimitive()
Gets whether this type is a primitive type.
|
boolean |
isReference()
Gets whether this type is a normal reference type.
|
boolean |
isUninitialized()
Gets whether this type represents an uninitialized instance.
|
java.lang.String |
toHuman()
Return the "human" string form of this instance.
|
java.lang.String |
toString() |
public static final int BT_VOID
voidpublic static final int BT_BOOLEAN
booleanpublic static final int BT_BYTE
bytepublic static final int BT_CHAR
charpublic static final int BT_DOUBLE
doublepublic static final int BT_FLOAT
floatpublic static final int BT_INT
intpublic static final int BT_LONG
longpublic static final int BT_SHORT
shortpublic static final int BT_OBJECT
Objectpublic static final int BT_ADDR
public static final int BT_COUNT
public static final Type BOOLEAN
non-null; instance representing booleanpublic static final Type BYTE
non-null; instance representing bytepublic static final Type CHAR
non-null; instance representing charpublic static final Type DOUBLE
non-null; instance representing doublepublic static final Type FLOAT
non-null; instance representing floatpublic static final Type INT
non-null; instance representing intpublic static final Type LONG
non-null; instance representing longpublic static final Type SHORT
non-null; instance representing shortpublic static final Type VOID
non-null; instance representing voidpublic static final Type KNOWN_NULL
non-null; instance representing a known-nullpublic static final Type RETURN_ADDRESS
non-null; instance representing a subroutine return addresspublic static final Type ANNOTATION
non-null; instance representing
java.lang.annotation.Annotationpublic static final Type CLASS
non-null; instance representing java.lang.Classpublic static final Type CLONEABLE
non-null; instance representing java.lang.Cloneablepublic static final Type METHOD_HANDLE
non-null; instance representing java.lang.invoke.MethodHandlepublic static final Type METHOD_TYPE
non-null; instance representing java.lang.invoke.MethodTypepublic static final Type VAR_HANDLE
non-null; instance representing java.lang.invoke.VarHandlepublic static final Type OBJECT
non-null; instance representing java.lang.Objectpublic static final Type SERIALIZABLE
non-null; instance representing java.io.Serializablepublic static final Type STRING
non-null; instance representing java.lang.Stringpublic static final Type THROWABLE
non-null; instance representing java.lang.Throwablepublic static final Type BOOLEAN_CLASS
non-null; instance representing java.lang.Boolean; the
suffix on the name helps disambiguate this from the instance
representing a primitive typepublic static final Type BYTE_CLASS
non-null; instance representing java.lang.Byte; the
suffix on the name helps disambiguate this from the instance
representing a primitive typepublic static final Type CHARACTER_CLASS
non-null; instance representing java.lang.Character; the
suffix on the name helps disambiguate this from the instance
representing a primitive typepublic static final Type DOUBLE_CLASS
non-null; instance representing java.lang.Double; the
suffix on the name helps disambiguate this from the instance
representing a primitive typepublic static final Type FLOAT_CLASS
non-null; instance representing java.lang.Float; the
suffix on the name helps disambiguate this from the instance
representing a primitive typepublic static final Type INTEGER_CLASS
non-null; instance representing java.lang.Integer; the
suffix on the name helps disambiguate this from the instance
representing a primitive typepublic static final Type LONG_CLASS
non-null; instance representing java.lang.Long; the
suffix on the name helps disambiguate this from the instance
representing a primitive typepublic static final Type SHORT_CLASS
non-null; instance representing java.lang.Short; the
suffix on the name helps disambiguate this from the instance
representing a primitive typepublic static final Type VOID_CLASS
non-null; instance representing java.lang.Void; the
suffix on the name helps disambiguate this from the instance
representing a primitive typepublic static final Type BOOLEAN_ARRAY
non-null; instance representing boolean[]public static final Type BYTE_ARRAY
non-null; instance representing byte[]public static final Type CHAR_ARRAY
non-null; instance representing char[]public static final Type DOUBLE_ARRAY
non-null; instance representing double[]public static final Type FLOAT_ARRAY
non-null; instance representing float[]public static final Type INT_ARRAY
non-null; instance representing int[]public static final Type LONG_ARRAY
non-null; instance representing long[]public static final Type OBJECT_ARRAY
non-null; instance representing Object[]public static final Type SHORT_ARRAY
non-null; instance representing short[]public static Type intern(java.lang.String descriptor)
"V" (that is, type void) as a valid
descriptor.descriptor - non-null; the descriptornon-null; the corresponding instancejava.lang.IllegalArgumentException - thrown if the descriptor has
invalid syntaxpublic static Type internReturnType(java.lang.String descriptor)
"V" to return the type
for void. Other than that one caveat, this method
is identical to intern(java.lang.String).descriptor - non-null; the descriptornon-null; the corresponding instancejava.lang.IllegalArgumentException - thrown if the descriptor has
invalid syntaxpublic static Type internClassName(java.lang.String name)
intern(name) if name begins
with "[" and calling intern("L" + name + ";")
in all other cases.name - non-null; the name of the class whose type
is desirednon-null; the corresponding typejava.lang.IllegalArgumentException - thrown if the name has
invalid syntaxpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(Type other)
compareTo in interface java.lang.Comparable<Type>public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toHuman()
toString().public Type getType()
getType in interface TypeBearernon-null; the typepublic Type getFrameType()
this, except if isIntlike() on the underlying
type returns true but the underlying type is not in
fact INT, in which case this method returns an instance
whose underlying type is INT.getFrameType in interface TypeBearernon-null; the frame type for this instancepublic int getBasicType()
getBasicType in interface TypeBearerBT_* constants
defined by Typepublic int getBasicFrameType()
getFrameType().getBasicType(), and
is the same as calling getFrameType() unless this
instance is an int-like type, in which case this method returns
BT_INT.getBasicFrameType in interface TypeBearerBT_* constants
defined by TypeTypeBearer.getBasicType(),
TypeBearer.getFrameType()public boolean isConstant()
isConstant in interface TypeBearertrue if this instance represents a constant value
and false if notpublic java.lang.String getDescriptor()
non-null; the descriptorpublic java.lang.String getClassName()
non-null; the internal-form class namepublic int getCategory()
long
and double are the only category 2 types.isCategory1(),
isCategory2()public boolean isCategory1()
getCategory(),
isCategory2()public boolean isCategory2()
getCategory(),
isCategory1()public boolean isIntlike()
int.public boolean isPrimitive()
public boolean isReference()
getBasicType() == Type.BT_OBJECT.public boolean isArray()
true, then it is safe to use getComponentType()
to determine the component type.public boolean isArrayOrKnownNull()
public boolean isUninitialized()
new
opcode, and remains uninitialized until a valid constructor is
invoked on it.public int getNewAt()
Integer.MAX_VALUE if this
type is an uninitialized incoming parameter (i.e., the
this of an <init> method) or
-1 if this type is in fact initialized.>= -1; the allocation bytecode indexpublic Type getInitializedType()
non-null; the initialized typepublic Type getArrayType()
non-null; the array typepublic Type getComponentType()
non-null; the component typepublic Type asUninitialized(int newAt)
newAt - >= 0; the allocation bytecode indexnon-null; an appropriately-constructed instancepublic static void clearInternTable()
Copyright © 2020. All Rights Reserved.