Class TypeName

java.lang.Object
com.ibm.wala.types.TypeName
All Implemented Interfaces:
Serializable

public final class TypeName extends Object implements Serializable
We've introduced this class to canonicalize Atoms that represent package names.

NB: All package names should use '/' and not '.' as a separator. eg. Ljava/lang/Class

See Also:
  • Field Details

  • Method Details

    • findOrCreate

      public static TypeName findOrCreate(ImmutableByteArray name, int start, int length) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • findOrCreate

      public static TypeName findOrCreate(ImmutableByteArray name) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • findOrCreate

      public static TypeName findOrCreate(String name) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • findOrCreateClass

      public static TypeName findOrCreateClass(Atom packageName, Atom className)
    • findOrCreate

      public static TypeName findOrCreate(Atom packageName, Atom className, int dim)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toUnicodeString

      public String toUnicodeString()
    • string2TypeName

      public static TypeName string2TypeName(String s) throws IllegalArgumentException
      Parameters:
      s - a String like Ljava/lang/Object
      Returns:
      the corresponding TypeName
      Throws:
      IllegalArgumentException - if s is null
    • findOrCreateClassName

      public static TypeName findOrCreateClassName(String packageName, String className)
    • parseForArrayElementName

      public TypeName parseForArrayElementName()
      Returns:
      the name of the array element type for an array
    • getArrayTypeForElementType

      public TypeName getArrayTypeForElementType()
    • getPointerTypeForElementType

      public TypeName getPointerTypeForElementType()
    • getReferenceTypeForElementType

      public TypeName getReferenceTypeForElementType()
    • getDerivedMask

      public int getDerivedMask()
      Returns:
      the dimensionality of the type. By convention, class types have dimensionality 0, primitives -1, and arrays the number of [ in their descriptor.
    • isClassType

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

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

      public boolean isPrimitiveType()
      Does 'this' refer to a primitive type
    • getInnermostElementType

      public TypeName getInnermostElementType()
      Return the innermost element type reference for an array
    • getPackage

      public Atom getPackage()
      Returns:
      the Atom naming the package for this type.
    • getClassName

      public Atom getClassName()
      Returns:
      the Atom naming the class for this type (without package)