Package com.ibm.wala.types
Class TypeReference
- java.lang.Object
-
- com.ibm.wala.types.TypeReference
-
- All Implemented Interfaces:
Serializable
public final class TypeReference extends Object implements Serializable
A class to represent the reference in a class file to some type (class, primitive or array). A type reference is uniquely defined by- an initiating class loader
- a type name
- See Also:
- Serialized Form
-
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
TypeReference(ClassLoaderReference cl, TypeName tn)
NB: All type names should use '/' and not '.' as a separator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
TypeReferences are canonical.static TypeReference
find(ClassLoaderReference cl, TypeName typeName)
Find the canonical TypeReference instance for the given pair.static TypeReference
find(ClassLoaderReference cl, String typeName)
static TypeReference
findOrCreate(ClassLoaderReference cl, TypeName typeName)
Find or create the canonical TypeReference instance for the given pair.static TypeReference
findOrCreate(ClassLoaderReference cl, String typeName)
Find or create the canonicalTypeReference
instance for the given pair.static TypeReference
findOrCreateArrayOf(TypeReference t)
static TypeReference
findOrCreateClass(ClassLoaderReference loader, String packageName, String className)
static TypeReference
findOrCreatePointerTo(TypeReference t)
static TypeReference
findOrCreateReferenceTo(TypeReference t)
TypeReference
getArrayElementType()
TODO: specialized form of TypeReference for arrays, please.TypeReference
getArrayTypeForElementType()
Get array type corresponding to "this" array element type.ClassLoaderReference
getClassLoader()
int
getDerivedMask()
Return the dimensionality of the type.int
getDimensionality()
TypeReference
getInnermostElementType()
Return the innermost element type reference for an arrayTypeName
getName()
int
hashCode()
boolean
isArrayType()
Does 'this' refer to an array?boolean
isClassType()
Does 'this' refer to a class?boolean
isPrimitiveType()
Does 'this' refer to a primitive typestatic boolean
isPrimitiveType(TypeName name)
Could name a represent a primitive type?boolean
isReferenceType()
Does 'this' refer to a reference typestatic TypeReference
makePrimitive(ClassLoaderReference cl, TypeName n)
String
toString()
-
-
-
Field Detail
-
BooleanName
public static final TypeName BooleanName
Primitive Dispatch *
-
BooleanTypeCode
public static final byte BooleanTypeCode
- See Also:
- Constant Field Values
-
Boolean
public static final TypeReference Boolean
-
ByteName
public static final TypeName ByteName
-
ByteTypeCode
public static final byte ByteTypeCode
- See Also:
- Constant Field Values
-
Byte
public static final TypeReference Byte
-
CharName
public static final TypeName CharName
-
CharTypeCode
public static final byte CharTypeCode
- See Also:
- Constant Field Values
-
Char
public static final TypeReference Char
-
DoubleName
public static final TypeName DoubleName
-
DoubleTypeCode
public static final byte DoubleTypeCode
- See Also:
- Constant Field Values
-
Double
public static final TypeReference Double
-
FloatName
public static final TypeName FloatName
-
FloatTypeCode
public static final byte FloatTypeCode
- See Also:
- Constant Field Values
-
Float
public static final TypeReference Float
-
IntName
public static final TypeName IntName
-
IntTypeCode
public static final byte IntTypeCode
- See Also:
- Constant Field Values
-
Int
public static final TypeReference Int
-
LongName
public static final TypeName LongName
-
LongTypeCode
public static final byte LongTypeCode
- See Also:
- Constant Field Values
-
Long
public static final TypeReference Long
-
ShortName
public static final TypeName ShortName
-
ShortTypeCode
public static final byte ShortTypeCode
- See Also:
- Constant Field Values
-
Short
public static final TypeReference Short
-
VoidName
public static final TypeName VoidName
-
VoidTypeCode
public static final byte VoidTypeCode
- See Also:
- Constant Field Values
-
Void
public static final TypeReference Void
-
OtherPrimitiveTypeCode
public static final byte OtherPrimitiveTypeCode
- See Also:
- Constant Field Values
-
BooleanArray
public static final TypeReference BooleanArray
Primitive Array Dispatch *
-
ByteArray
public static final TypeReference ByteArray
-
CharArray
public static final TypeReference CharArray
-
DoubleArray
public static final TypeReference DoubleArray
-
FloatArray
public static final TypeReference FloatArray
-
IntArray
public static final TypeReference IntArray
-
LongArray
public static final TypeReference LongArray
-
ShortArray
public static final TypeReference ShortArray
-
JavaLangArithmeticException
public static final TypeReference JavaLangArithmeticException
-
JavaLangArrayStoreException
public static final TypeReference JavaLangArrayStoreException
-
JavaLangArrayIndexOutOfBoundsException
public static final TypeReference JavaLangArrayIndexOutOfBoundsException
-
JavaLangClass
public static final TypeReference JavaLangClass
-
JavaLangInvokeMethodHandle
public static final TypeReference JavaLangInvokeMethodHandle
-
JavaLangInvokeMethodType
public static final TypeReference JavaLangInvokeMethodType
-
JavaLangClassCastException
public static final TypeReference JavaLangClassCastException
-
JavaLangComparable
public static final TypeReference JavaLangComparable
-
JavaLangReflectConstructor
public static final TypeReference JavaLangReflectConstructor
-
JavaLangReflectMethod
public static final TypeReference JavaLangReflectMethod
-
JavaLangEnum
public static final TypeReference JavaLangEnum
-
JavaLangError
public static final TypeReference JavaLangError
-
JavaLangException
public static final TypeReference JavaLangException
-
JavaLangNegativeArraySizeException
public static final TypeReference JavaLangNegativeArraySizeException
-
JavaLangNullPointerException
public static final TypeReference JavaLangNullPointerException
-
JavaLangRuntimeException
public static final TypeReference JavaLangRuntimeException
-
JavaLangClassNotFoundException
public static final TypeReference JavaLangClassNotFoundException
-
JavaLangOutOfMemoryError
public static final TypeReference JavaLangOutOfMemoryError
-
JavaLangExceptionInInitializerError
public static final TypeReference JavaLangExceptionInInitializerError
-
JavaLangObject
public static final TypeReference JavaLangObject
-
JavaLangStackTraceElement
public static final TypeReference JavaLangStackTraceElement
-
JavaLangString
public static final TypeReference JavaLangString
-
JavaLangStringBuffer
public static final TypeReference JavaLangStringBuffer
-
JavaLangStringBuilder
public static final TypeReference JavaLangStringBuilder
-
JavaLangThread
public static final TypeReference JavaLangThread
-
JavaLangThrowable
public static final TypeReference JavaLangThrowable
-
JavaLangCloneableName
public static final TypeName JavaLangCloneableName
-
JavaLangCloneable
public static final TypeReference JavaLangCloneable
-
JavaLangSystem
public static final TypeReference JavaLangSystem
-
JavaLangInteger
public static final TypeReference JavaLangInteger
-
JavaLangBoolean
public static final TypeReference JavaLangBoolean
-
JavaLangDouble
public static final TypeReference JavaLangDouble
-
JavaLangFloat
public static final TypeReference JavaLangFloat
-
JavaLangShort
public static final TypeReference JavaLangShort
-
JavaLangLong
public static final TypeReference JavaLangLong
-
JavaLangByte
public static final TypeReference JavaLangByte
-
JavaLangCharacter
public static final TypeReference JavaLangCharacter
-
JavaIoSerializableName
public static final TypeName JavaIoSerializableName
-
JavaIoSerializable
public static final TypeReference JavaIoSerializable
-
JavaUtilCollection
public static final TypeReference JavaUtilCollection
-
JavaUtilMap
public static final TypeReference JavaUtilMap
-
JavaUtilHashSet
public static final TypeReference JavaUtilHashSet
-
JavaUtilSet
public static final TypeReference JavaUtilSet
-
JavaUtilEnum
public static final TypeReference JavaUtilEnum
-
JavaUtilIterator
public static final TypeReference JavaUtilIterator
-
JavaUtilVector
public static final TypeReference JavaUtilVector
-
ClassTypeCode
public static final byte ClassTypeCode
- See Also:
- Constant Field Values
-
ArrayTypeCode
public static final byte ArrayTypeCode
- See Also:
- Constant Field Values
-
PointerTypeCode
public static final byte PointerTypeCode
- See Also:
- Constant Field Values
-
ReferenceTypeCode
public static final byte ReferenceTypeCode
- See Also:
- Constant Field Values
-
Null
public static final TypeReference Null
-
Unknown
public static final TypeReference Unknown
-
LambdaMetaFactory
public static final TypeReference LambdaMetaFactory
-
-
Constructor Detail
-
TypeReference
protected TypeReference(ClassLoaderReference cl, TypeName tn)
NB: All type names should use '/' and not '.' as a separator. eg. Ljava/lang/Class- Parameters:
cl
- the classloadertn
- the type name
-
-
Method Detail
-
makePrimitive
public static TypeReference makePrimitive(ClassLoaderReference cl, TypeName n)
-
isPrimitiveType
public static boolean isPrimitiveType(TypeName name)
Could name a represent a primitive type?
-
findOrCreate
public static TypeReference findOrCreate(ClassLoaderReference cl, TypeName typeName)
Find or create the canonical TypeReference instance for the given pair.- Parameters:
cl
- the classloader (defining/initiating depending on usage)
-
findOrCreate
public static TypeReference findOrCreate(ClassLoaderReference cl, String typeName)
Find or create the canonicalTypeReference
instance for the given pair.- Parameters:
cl
- the classloader (defining/initiating depending on usage)typeName
- something like "Ljava/util/Arrays"
-
find
public static TypeReference find(ClassLoaderReference cl, String typeName)
-
find
public static TypeReference find(ClassLoaderReference cl, TypeName typeName)
Find the canonical TypeReference instance for the given pair. May return null.- Parameters:
cl
- the classloader (defining/initiating depending on usage)
-
findOrCreateArrayOf
public static TypeReference findOrCreateArrayOf(TypeReference t)
-
findOrCreateReferenceTo
public static TypeReference findOrCreateReferenceTo(TypeReference t)
-
findOrCreatePointerTo
public static TypeReference findOrCreatePointerTo(TypeReference t)
-
getClassLoader
public final ClassLoaderReference getClassLoader()
- Returns:
- the classloader component of this type reference
-
getName
public final TypeName getName()
- Returns:
- the type name component of this type reference
-
getArrayElementType
public final TypeReference getArrayElementType()
TODO: specialized form of TypeReference for arrays, please. Get the element type of for this array type.
-
getArrayTypeForElementType
public final TypeReference getArrayTypeForElementType()
Get array type corresponding to "this" array element type.
-
getDerivedMask
public final int getDerivedMask()
Return the dimensionality of the type. By convention, class types have dimensionality 0, primitives -1, and arrays the number of [ in their descriptor.
-
getInnermostElementType
public final TypeReference getInnermostElementType()
Return the innermost element type reference for an array
-
isClassType
public final boolean isClassType()
Does 'this' refer to a class?
-
isArrayType
public final boolean isArrayType()
Does 'this' refer to an array?
-
isPrimitiveType
public final boolean isPrimitiveType()
Does 'this' refer to a primitive type
-
isReferenceType
public final boolean isReferenceType()
Does 'this' refer to a reference type
-
equals
public final boolean equals(Object other)
TypeReferences are canonical. However, note that two TypeReferences can be non-equal, yet still represent the same IClass. For example, the there can be two TypeReferencesand . These two TypeReference are NOT equal(), but they both represent the IClass which is named
-
findOrCreateClass
public static TypeReference findOrCreateClass(ClassLoaderReference loader, String packageName, String className)
-
getDimensionality
public int getDimensionality()
-
-