Class CstType

All Implemented Interfaces:
TypeBearer, ToHuman, Comparable<Constant>

public final class CstType extends TypedConstant
Constants that represent an arbitrary type (reference or primitive).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final CstType
    non-null; instance corresponding to the class Boolean
    static final CstType
    non-null; instance corresponding to the type boolean[]
    static final CstType
    non-null; instance corresponding to the class Byte
    static final CstType
    non-null; instance corresponding to the type byte[]
    static final CstType
    non-null; instance corresponding to the type char[]
    static final CstType
    non-null; instance corresponding to the class Character
    static final CstType
    non-null; instance corresponding to the class Double
    static final CstType
    non-null; instance corresponding to the type double[]
    static final CstType
    non-null; instance corresponding to the class Float
    static final CstType
    non-null; instance corresponding to the type float[]
    static final CstType
    non-null; instance corresponding to the type int[]
    static final CstType
    non-null; instance corresponding to the class Integer
    static final CstType
    non-null; instance corresponding to the class Long
    static final CstType
    non-null; instance corresponding to the type long[]
    static final CstType
    non-null; instance corresponding to the type java.lang.invoke.MethodHandle
    static final CstType
    non-null; instance corresponding to the class Object
    static final CstType
    non-null; instance corresponding to the class Short
    static final CstType
    non-null; instance corresponding to the type short[]
    static final CstType
    non-null; instance corresponding to the type java.lang.invoke.VarHandle
    static final CstType
    non-null; instance corresponding to the class Void
  • Constructor Summary

    Constructors
    Constructor
    Description
    CstType(Type type)
    Constructs an instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    protected int
    Compare the values of this and another instance, which are guaranteed to be of the same class.
    boolean
    equals(Object other)
    static CstType
    forBoxedPrimitiveType(Type primitiveType)
    Returns an instance of this class that represents the wrapper class corresponding to a given primitive type.
    Gets the underlying type (as opposed to the type corresponding to this instance as a constant, which is always Class).
    Gets the type descriptor for this instance.
    Returns a human readable package name for this type, like "java.util".
    Gets the type associated with this instance.
    int
    static CstType
    intern(Type type)
    Returns an interned instance of this class for the given type.
    boolean
    Returns true if this instance is a category-2 constant, meaning it takes up two slots in the constant pool, or false if this instance is category-1.
    Return the "human" string form of this instance.
    Returns the human name for the particular type of constant this instance is.

    Methods inherited from class com.android.dx.rop.cst.TypedConstant

    getBasicFrameType, getBasicType, getFrameType, isConstant

    Methods inherited from class com.android.dx.rop.cst.Constant

    compareTo

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • OBJECT

      public static final CstType OBJECT
      non-null; instance corresponding to the class Object
    • BOOLEAN

      public static final CstType BOOLEAN
      non-null; instance corresponding to the class Boolean
    • BYTE

      public static final CstType BYTE
      non-null; instance corresponding to the class Byte
    • CHARACTER

      public static final CstType CHARACTER
      non-null; instance corresponding to the class Character
    • DOUBLE

      public static final CstType DOUBLE
      non-null; instance corresponding to the class Double
    • FLOAT

      public static final CstType FLOAT
      non-null; instance corresponding to the class Float
    • LONG

      public static final CstType LONG
      non-null; instance corresponding to the class Long
    • INTEGER

      public static final CstType INTEGER
      non-null; instance corresponding to the class Integer
    • SHORT

      public static final CstType SHORT
      non-null; instance corresponding to the class Short
    • VOID

      public static final CstType VOID
      non-null; instance corresponding to the class Void
    • BOOLEAN_ARRAY

      public static final CstType BOOLEAN_ARRAY
      non-null; instance corresponding to the type boolean[]
    • BYTE_ARRAY

      public static final CstType BYTE_ARRAY
      non-null; instance corresponding to the type byte[]
    • CHAR_ARRAY

      public static final CstType CHAR_ARRAY
      non-null; instance corresponding to the type char[]
    • DOUBLE_ARRAY

      public static final CstType DOUBLE_ARRAY
      non-null; instance corresponding to the type double[]
    • FLOAT_ARRAY

      public static final CstType FLOAT_ARRAY
      non-null; instance corresponding to the type float[]
    • LONG_ARRAY

      public static final CstType LONG_ARRAY
      non-null; instance corresponding to the type long[]
    • INT_ARRAY

      public static final CstType INT_ARRAY
      non-null; instance corresponding to the type int[]
    • SHORT_ARRAY

      public static final CstType SHORT_ARRAY
      non-null; instance corresponding to the type short[]
    • METHOD_HANDLE

      public static final CstType METHOD_HANDLE
      non-null; instance corresponding to the type java.lang.invoke.MethodHandle
    • VAR_HANDLE

      public static final CstType VAR_HANDLE
      non-null; instance corresponding to the type java.lang.invoke.VarHandle
  • Constructor Details

    • CstType

      public CstType(Type type)
      Constructs an instance.
      Parameters:
      type - non-null; the underlying type
  • Method Details

    • forBoxedPrimitiveType

      public static CstType forBoxedPrimitiveType(Type primitiveType)
      Returns an instance of this class that represents the wrapper class corresponding to a given primitive type. For example, if given Type.INT, this method returns the class reference java.lang.Integer.
      Parameters:
      primitiveType - non-null; the primitive type
      Returns:
      non-null; the corresponding wrapper class
    • intern

      public static CstType intern(Type type)
      Returns an interned instance of this class for the given type.
      Parameters:
      type - non-null; the underlying type
      Returns:
      non-null; an appropriately-constructed instance
    • equals

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

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

      protected int compareTo0(Constant other)
      Compare the values of this and another instance, which are guaranteed to be of the same class. Subclasses must implement this.
      Specified by:
      compareTo0 in class Constant
      Parameters:
      other - non-null; the instance to compare to
      Returns:
      -1, 0, or 1, as usual for a comparison
    • toString

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

      public Type getType()
      Gets the type associated with this instance.
      Returns:
      non-null; the type
    • typeName

      public String typeName()
      Returns the human name for the particular type of constant this instance is.
      Specified by:
      typeName in class Constant
      Returns:
      non-null; the name
    • isCategory2

      public boolean isCategory2()
      Returns true if this instance is a category-2 constant, meaning it takes up two slots in the constant pool, or false if this instance is category-1.
      Specified by:
      isCategory2 in class Constant
      Returns:
      true iff this instance is category-2
    • toHuman

      public String toHuman()
      Return the "human" string form of this instance. This is generally less "debuggy" than toString().
      Returns:
      non-null; the human string form
    • getClassType

      public Type getClassType()
      Gets the underlying type (as opposed to the type corresponding to this instance as a constant, which is always Class).
      Returns:
      non-null; the type corresponding to the name
    • getDescriptor

      public CstString getDescriptor()
      Gets the type descriptor for this instance.
      Returns:
      non-null; the descriptor
    • getPackageName

      public String getPackageName()
      Returns a human readable package name for this type, like "java.util". If this is an array type, this returns the package name of the array's component type. If this is a primitive type, this returns "default".
    • clearInternTable

      public static void clearInternTable()