Class NdTypeSignature

All Implemented Interfaces:
IDestructable, INdStruct
Direct Known Subclasses:
NdComplexTypeSignature, NdTypeId

public abstract class NdTypeSignature extends NdNode
Corresponds roughly to a JavaTypeSignature, as described in section 4.7.9.1 of the Java VM spec version 4, with the addition of annotations and backpointers to locations where the type is used.

Holds back-pointers to all the entities that refer to the name, along with pointers to all classes that have this name. Note that this isn't the class declaration itself. The same index can hold multiple jar files, some of which may contain classes with the same name. All classes that use this fully-qualified name point to the same NdTypeSignature.

Other entities should refer to a type via its TypeId if there is any possiblity that the type may change based on the classpath. It should refer to the type directly if there is no possibility for a type lookup. For example, nested classes refer to their enclosing class directly since they live in the same file and there is no possibility for the enclosing class to change based on the classpath. Classes refer to their base class via its TypeId since the parent class might live in a different jar and need to be resolved on the classpath.

  • Field Details

  • Constructor Details

    • NdTypeSignature

      public NdTypeSignature(Nd nd, long address)
    • NdTypeSignature

      public NdTypeSignature(Nd nd)
  • Method Details

    • getSubclasses

      public List<NdType> getSubclasses()
    • getImplementations

      public List<NdTypeInterface> getImplementations()
    • getSubTypes

      public List<NdType> getSubTypes()
      Returns all subclasses (for classes) and implementations (for interfaces) of this type
    • getRawType

      public abstract NdTypeId getRawType()
      Returns the raw version of this type, if one exists. That is, the version of this type without any generic arguments or annotations, which the java runtime sees. Returns null of this signature doesn't have a raw type, for example if it is a type variable.
    • getSignature

      public final void getSignature(CharArrayBuffer result)
    • getSignature

      public abstract void getSignature(CharArrayBuffer result, boolean includeTrailingSemicolon)
    • isArrayType

      public abstract boolean isArrayType()
      Returns true iff this is an array type signature (ie: that getArrayDimensionType() will return a non-null answer). Note that this only returns true for the type signature that holds the reference to the array dimension type. The raw type for that signature will return false, even though it has a field descriptor starting with '['.

      In other words:

       NdVariable someVariable = getSomeVariableWithAnArrayType()
       System.out.println(someVariable.getType().isArrayType()); // true
       System.out.println(someVariable.getType().getRawType().isArrayType()); // false
       
    • isTypeVariable

      public abstract boolean isTypeVariable()
    • getDeclaringTypeChain

      public abstract List<NdTypeSignature> getDeclaringTypeChain()
      Returns the chain of declaring generic types. The first element in the chain is a top-level type and the receiver is the last element in the chain.
    • getArrayDimensionType

      public abstract NdTypeSignature getArrayDimensionType()
      If the receiver is an array type, it returns the signature of the array's next dimension. Returns null if this is not an array type.
    • getTypeArguments

      public abstract List<NdTypeArgument> getTypeArguments()
      Returns the type arguments for this type signature, if any. Returns the empty list if none.
    • toString

      public String toString()
      Overrides:
      toString in class Object