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
Resolving a TypeReference to a Type can be an expensive operation. Therefore we canonicalize TypeReference instances and cache the result of resolution.
See Also:
  • Field Details Link icon

    • BooleanName Link icon

      public static final TypeName BooleanName
    • BooleanTypeCode Link icon

      public static final byte BooleanTypeCode
      See Also:
    • Boolean Link icon

      public static final TypeReference Boolean
    • ByteName Link icon

      public static final TypeName ByteName
    • ByteTypeCode Link icon

      public static final byte ByteTypeCode
      See Also:
    • Byte Link icon

      public static final TypeReference Byte
    • CharName Link icon

      public static final TypeName CharName
    • CharTypeCode Link icon

      public static final byte CharTypeCode
      See Also:
    • Char Link icon

      public static final TypeReference Char
    • DoubleName Link icon

      public static final TypeName DoubleName
    • DoubleTypeCode Link icon

      public static final byte DoubleTypeCode
      See Also:
    • Double Link icon

      public static final TypeReference Double
    • FloatName Link icon

      public static final TypeName FloatName
    • FloatTypeCode Link icon

      public static final byte FloatTypeCode
      See Also:
    • Float Link icon

      public static final TypeReference Float
    • IntName Link icon

      public static final TypeName IntName
    • IntTypeCode Link icon

      public static final byte IntTypeCode
      See Also:
    • Int Link icon

      public static final TypeReference Int
    • LongName Link icon

      public static final TypeName LongName
    • LongTypeCode Link icon

      public static final byte LongTypeCode
      See Also:
    • Long Link icon

      public static final TypeReference Long
    • ShortName Link icon

      public static final TypeName ShortName
    • ShortTypeCode Link icon

      public static final byte ShortTypeCode
      See Also:
    • Short Link icon

      public static final TypeReference Short
    • VoidName Link icon

      public static final TypeName VoidName
    • VoidTypeCode Link icon

      public static final byte VoidTypeCode
      See Also:
    • Void Link icon

      public static final TypeReference Void
    • OtherPrimitiveTypeCode Link icon

      public static final byte OtherPrimitiveTypeCode
      See Also:
    • BooleanArray Link icon

      public static final TypeReference BooleanArray
    • ByteArray Link icon

      public static final TypeReference ByteArray
    • CharArray Link icon

      public static final TypeReference CharArray
    • DoubleArray Link icon

      public static final TypeReference DoubleArray
    • FloatArray Link icon

      public static final TypeReference FloatArray
    • IntArray Link icon

      public static final TypeReference IntArray
    • LongArray Link icon

      public static final TypeReference LongArray
    • ShortArray Link icon

      public static final TypeReference ShortArray
    • JavaLangArithmeticException Link icon

      public static final TypeReference JavaLangArithmeticException
    • JavaLangArrayStoreException Link icon

      public static final TypeReference JavaLangArrayStoreException
    • JavaLangArrayIndexOutOfBoundsException Link icon

      public static final TypeReference JavaLangArrayIndexOutOfBoundsException
    • JavaLangClass Link icon

      public static final TypeReference JavaLangClass
    • JavaLangInvokeMethodHandle Link icon

      public static final TypeReference JavaLangInvokeMethodHandle
    • JavaLangInvokeMethodHandlesLookup Link icon

      public static final TypeReference JavaLangInvokeMethodHandlesLookup
    • JavaLangInvokeMethodType Link icon

      public static final TypeReference JavaLangInvokeMethodType
    • JavaLangClassCastException Link icon

      public static final TypeReference JavaLangClassCastException
    • JavaLangComparable Link icon

      public static final TypeReference JavaLangComparable
    • JavaLangReflectConstructor Link icon

      public static final TypeReference JavaLangReflectConstructor
    • JavaLangReflectMethod Link icon

      public static final TypeReference JavaLangReflectMethod
    • JavaLangEnum Link icon

      public static final TypeReference JavaLangEnum
    • JavaLangError Link icon

      public static final TypeReference JavaLangError
    • JavaLangException Link icon

      public static final TypeReference JavaLangException
    • JavaLangNegativeArraySizeException Link icon

      public static final TypeReference JavaLangNegativeArraySizeException
    • JavaLangNullPointerException Link icon

      public static final TypeReference JavaLangNullPointerException
    • JavaLangRuntimeException Link icon

      public static final TypeReference JavaLangRuntimeException
    • JavaLangClassNotFoundException Link icon

      public static final TypeReference JavaLangClassNotFoundException
    • JavaLangOutOfMemoryError Link icon

      public static final TypeReference JavaLangOutOfMemoryError
    • JavaLangExceptionInInitializerError Link icon

      public static final TypeReference JavaLangExceptionInInitializerError
    • JavaLangObject Link icon

      public static final TypeReference JavaLangObject
    • JavaLangStackTraceElement Link icon

      public static final TypeReference JavaLangStackTraceElement
    • JavaLangString Link icon

      public static final TypeReference JavaLangString
    • JavaLangStringBuffer Link icon

      public static final TypeReference JavaLangStringBuffer
    • JavaLangStringBuilder Link icon

      public static final TypeReference JavaLangStringBuilder
    • JavaLangThread Link icon

      public static final TypeReference JavaLangThread
    • JavaLangThrowable Link icon

      public static final TypeReference JavaLangThrowable
    • JavaLangCloneableName Link icon

      public static final TypeName JavaLangCloneableName
    • JavaLangCloneable Link icon

      public static final TypeReference JavaLangCloneable
    • JavaLangSystem Link icon

      public static final TypeReference JavaLangSystem
    • JavaLangInteger Link icon

      public static final TypeReference JavaLangInteger
    • JavaLangBoolean Link icon

      public static final TypeReference JavaLangBoolean
    • JavaLangDouble Link icon

      public static final TypeReference JavaLangDouble
    • JavaLangFloat Link icon

      public static final TypeReference JavaLangFloat
    • JavaLangShort Link icon

      public static final TypeReference JavaLangShort
    • JavaLangLong Link icon

      public static final TypeReference JavaLangLong
    • JavaLangByte Link icon

      public static final TypeReference JavaLangByte
    • JavaLangCharacter Link icon

      public static final TypeReference JavaLangCharacter
    • JavaIoSerializableName Link icon

      public static final TypeName JavaIoSerializableName
    • JavaIoSerializable Link icon

      public static final TypeReference JavaIoSerializable
    • JavaUtilCollection Link icon

      public static final TypeReference JavaUtilCollection
    • JavaUtilMap Link icon

      public static final TypeReference JavaUtilMap
    • JavaUtilHashSet Link icon

      public static final TypeReference JavaUtilHashSet
    • JavaUtilSet Link icon

      public static final TypeReference JavaUtilSet
    • JavaUtilEnum Link icon

      public static final TypeReference JavaUtilEnum
    • JavaUtilIterator Link icon

      public static final TypeReference JavaUtilIterator
    • JavaUtilVector Link icon

      public static final TypeReference JavaUtilVector
    • ClassTypeCode Link icon

      public static final byte ClassTypeCode
      See Also:
    • ArrayTypeCode Link icon

      public static final byte ArrayTypeCode
      See Also:
    • PointerTypeCode Link icon

      public static final byte PointerTypeCode
      See Also:
    • ReferenceTypeCode Link icon

      public static final byte ReferenceTypeCode
      See Also:
    • Null Link icon

      public static final TypeReference Null
    • Unknown Link icon

      public static final TypeReference Unknown
    • LambdaMetaFactory Link icon

      public static final TypeReference LambdaMetaFactory
  • Method Details Link icon

    • makePrimitive Link icon

      public static TypeReference makePrimitive(ClassLoaderReference cl, TypeName n)
    • isPrimitiveType Link icon

      public static boolean isPrimitiveType(TypeName name)
      Could name a represent a primitive type?
    • findOrCreate Link icon

      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 Link icon

      public static TypeReference findOrCreate(ClassLoaderReference cl, String typeName)
      Find or create the canonical TypeReference instance for the given pair.
      Parameters:
      cl - the classloader (defining/initiating depending on usage)
      typeName - something like "Ljava/util/Arrays"
    • find Link icon

      public static TypeReference find(ClassLoaderReference cl, String typeName)
    • find Link icon

      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 Link icon

      public static TypeReference findOrCreateArrayOf(TypeReference t)
    • findOrCreateReferenceTo Link icon

      public static TypeReference findOrCreateReferenceTo(TypeReference t)
    • findOrCreatePointerTo Link icon

      public static TypeReference findOrCreatePointerTo(TypeReference t)
    • getClassLoader Link icon

      public ClassLoaderReference getClassLoader()
      Returns:
      the classloader component of this type reference
    • getName Link icon

      public TypeName getName()
      Returns:
      the type name component of this type reference
    • getArrayElementType Link icon

      public TypeReference getArrayElementType()
      TODO: specialized form of TypeReference for arrays, please. Get the element type of for this array type.
    • getArrayTypeForElementType Link icon

      public TypeReference getArrayTypeForElementType()
      Get array type corresponding to "this" array element type.
    • getDerivedMask Link icon

      public 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 Link icon

      public TypeReference getInnermostElementType()
      Return the innermost element type reference for an array
    • isClassType Link icon

      public boolean isClassType()
      Does 'this' refer to a class?
    • isArrayType Link icon

      public boolean isArrayType()
      Does 'this' refer to an array?
    • isPrimitiveType Link icon

      public boolean isPrimitiveType()
      Does 'this' refer to a primitive type
    • isReferenceType Link icon

      public boolean isReferenceType()
      Does 'this' refer to a reference type
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals Link icon

      public 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 TypeReferences <Application,java.lang.Object> and <Primordial,java.lang.Object>. These two TypeReference are NOT equal(), but they both represent the IClass which is named <Primordial,java.lang.Object>

      Overrides:
      equals in class Object
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • findOrCreateClass Link icon

      public static TypeReference findOrCreateClass(ClassLoaderReference loader, String packageName, String className)
    • getDimensionality Link icon

      public int getDimensionality()