Class ClassTypeSignature


public final class ClassTypeSignature extends HierarchicalTypeSignature
A class type signature (called "ClassSignature" in the classfile documentation).
  • Field Details

    • classInfo

      private final ClassInfo classInfo
      The class info.
    • typeParameters

      final List<TypeParameter> typeParameters
      The class type parameters.
    • superclassSignature

      private final ClassRefTypeSignature superclassSignature
      The superclass type.
    • superinterfaceSignatures

      private final List<ClassRefTypeSignature> superinterfaceSignatures
      The superinterface signatures.
    • throwsSignatures

      private final List<ClassRefOrTypeVariableSignature> throwsSignatures
      The throws signatures (usually null). These are only present in Scala classes, if the class is marked up with @throws, and they violate the classfile spec (#495), but we parse them anyway.
  • Constructor Details

    • ClassTypeSignature

      private ClassTypeSignature(ClassInfo classInfo, List<TypeParameter> typeParameters, ClassRefTypeSignature superclassSignature, List<ClassRefTypeSignature> superinterfaceSignatures, List<ClassRefOrTypeVariableSignature> throwsSignatures)
      Constructor.
      Parameters:
      classInfo - the ClassInfo object of the class.
      typeParameters - The class type parameters.
      superclassSignature - The superclass signature.
      superinterfaceSignatures - The superinterface signature(s).
      throwsSignatures - the throws signatures (these are actually invalid, but can be added by Scala: #495). Usually null.
    • ClassTypeSignature

      ClassTypeSignature(ClassInfo classInfo, ClassInfo superclass, ClassInfoList interfaces)
      Constructor used to create synthetic class type descriptor (#662).
      Parameters:
      classInfo - The class.
      superclass - The superclass.
      interfaces - The implemented interfaces.
  • Method Details

    • getTypeParameters

      public List<TypeParameter> getTypeParameters()
      Get the type parameters for the class.
      Returns:
      The type parameters for the class.
    • getSuperclassSignature

      public ClassRefTypeSignature getSuperclassSignature()
      Get the type signature for the superclass (possibly null in the case of Object, since it doesn't have a superclass).
      Returns:
      The type signature for the superclass, or null if no superclass (i.e. for Object).
    • getSuperinterfaceSignatures

      public List<ClassRefTypeSignature> getSuperinterfaceSignatures()
      Get the type signatures of any superinterfaces.
      Returns:
      The type signatures of any superinterfaces.
    • getThrowsSignatures

      List<ClassRefOrTypeVariableSignature> getThrowsSignatures()
      Gets the throws signatures. These are invalid according to the classfile spec (so this method is currently non-public), but may be added by the Scala compiler. (See bug #495.)
      Returns:
      the throws signatures
    • addTypeAnnotation

      protected void addTypeAnnotation(List<Classfile.TypePathNode> typePath, AnnotationInfo annotationInfo)
      Description copied from class: HierarchicalTypeSignature
      Add a type annotation.
      Specified by:
      addTypeAnnotation in class HierarchicalTypeSignature
      Parameters:
      typePath - the type path
      annotationInfo - the annotation
    • getClassName

      protected String getClassName()
      Description copied from class: ScanResultObject
      The name of the class (used by ScanResultObject.getClassInfo() to fetch the ClassInfo object for the class).
      Specified by:
      getClassName in class ScanResultObject
      Returns:
      The class name.
    • getClassInfo

      protected ClassInfo getClassInfo()
      Description copied from class: ScanResultObject
      Get the ClassInfo object for the referenced class, or null if the referenced class was not encountered during scanning (i.e. no ClassInfo object was created for the class during scanning). N.B. even if this method returns null, ScanResultObject.loadClass() may be able to load the referenced class by name.
      Overrides:
      getClassInfo in class ScanResultObject
      Returns:
      The ClassInfo object for the referenced class.
    • setScanResult

      void setScanResult(ScanResult scanResult)
      Description copied from class: ScanResultObject
      Set ScanResult backreferences in info objects after scan has completed.
      Overrides:
      setScanResult in class HierarchicalTypeSignature
      Parameters:
      scanResult - the scan result
    • findReferencedClassNames

      protected void findReferencedClassNames(Set<String> refdClassNames)
      Get the names of any classes referenced in the type signature.
      Parameters:
      refdClassNames - the referenced class names.
    • findReferencedClassInfo

      protected void findReferencedClassInfo(Map<String,ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, LogNode log)
      Get ClassInfo objects for any classes referenced in the type descriptor or type signature.
      Overrides:
      findReferencedClassInfo in class ScanResultObject
      Parameters:
      classNameToClassInfo - the map from class name to ClassInfo.
      refdClassInfo - the referenced class info
      log - the log
    • hashCode

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

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

      void toStringInternal(String className, boolean useSimpleNames, int modifiers, boolean isAnnotation, boolean isInterface, AnnotationInfoList annotationsToExclude, StringBuilder buf)
      Render into String form.
      Parameters:
      className - The class name
      useSimpleNames - the use simple names
      modifiers - The class modifiers.
      isAnnotation - True if the class is an annotation.
      isInterface - True if the class is an interface.
      annotationsToExclude - the annotations to exclude
      buf - the buf
    • toStringInternal

      protected void toStringInternal(boolean useSimpleNames, AnnotationInfoList annotationsToExclude, StringBuilder buf)
      To string internal.
      Specified by:
      toStringInternal in class HierarchicalTypeSignature
      Parameters:
      useSimpleNames - the use simple names
      annotationsToExclude - the annotations to exclude
      buf - the buf
    • parse

      static ClassTypeSignature parse(String typeDescriptor, ClassInfo classInfo) throws ParseException
      Parse a class type signature or class type descriptor.
      Parameters:
      typeDescriptor - The class type signature or class type descriptor to parse.
      classInfo - the class info
      Returns:
      The parsed class type signature or class type descriptor.
      Throws:
      ParseException - If the class type signature could not be parsed.