Class NdComplexTypeSignature

All Implemented Interfaces:
IDestructable, INdStruct

public class NdComplexTypeSignature extends NdTypeSignature
Represents a type signature that is anything other than a trivial reference to a concrete type. If a type reference includes annotations, generic arguments, wildcards, or is a type variable, this object represents it.

Arrays are encoded in a special way. The RAW_TYPE points to a sentinel type called '[' and the first type argument holds the array type.

  • Field Details

  • Constructor Details

    • NdComplexTypeSignature

      public NdComplexTypeSignature(Nd nd, long address)
    • NdComplexTypeSignature

      public NdComplexTypeSignature(Nd nd)
  • Method Details

    • getRawType

      public NdTypeId getRawType()
      Description copied from class: NdTypeSignature
      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.
      Specified by:
      getRawType in class NdTypeSignature
    • setVariableIdentifier

      public void setVariableIdentifier(char[] variableIdentifier)
    • getVariableIdentifier

      public IString getVariableIdentifier()
      If this type is a type variable, this returns the variable's identifier.
    • setRawType

      public void setRawType(NdTypeId rawType)
    • setGenericDeclaringType

      public void setGenericDeclaringType(NdComplexTypeSignature enclosingType)
    • getGenericDeclaringType

      public NdComplexTypeSignature getGenericDeclaringType()
      Returns the declaring type (as reported by the type's generic signature). Not to be confused with the declaring type as stored in the class file. That is stored in NdType.getDeclaringType(). Any class that is nested inside another class with generic arguments will have one of these. Classes nested inside non-generic classes won't have one of these, and neither will non-nested classes.
    • getTypeArguments

      public List<NdTypeArgument> getTypeArguments()
      Description copied from class: NdTypeSignature
      Returns the type arguments for this type signature, if any. Returns the empty list if none.
      Specified by:
      getTypeArguments in class NdTypeSignature
    • getArrayDimensionType

      public NdTypeSignature getArrayDimensionType()
      Description copied from class: NdTypeSignature
      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.
      Specified by:
      getArrayDimensionType in class NdTypeSignature
    • getSignature

      public void getSignature(CharArrayBuffer result, boolean includeTrailingSemicolon)
      Specified by:
      getSignature in class NdTypeSignature
    • isTypeVariable

      public boolean isTypeVariable()
      Specified by:
      isTypeVariable in class NdTypeSignature
    • getDeclaringTypeChain

      public List<NdTypeSignature> getDeclaringTypeChain()
      Description copied from class: NdTypeSignature
      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.
      Specified by:
      getDeclaringTypeChain in class NdTypeSignature
    • isArrayType

      public boolean isArrayType()
      Description copied from class: NdTypeSignature
      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
       
      Specified by:
      isArrayType in class NdTypeSignature