Class ClassTypeSignature
java.lang.Object
io.github.classgraph.ScanResultObject
io.github.classgraph.HierarchicalTypeSignature
io.github.classgraph.ClassTypeSignature
A class type signature (called "ClassSignature" in the classfile documentation).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClassInfoThe class info.private final ClassRefTypeSignatureThe superclass type.private final List<ClassRefTypeSignature> The superinterface signatures.private final List<ClassRefOrTypeVariableSignature> The throws signatures (usually null).(package private) final List<TypeParameter> The class type parameters.Fields inherited from class HierarchicalTypeSignature
typeAnnotationInfoFields inherited from class ScanResultObject
classRef, scanResult -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)ClassTypeSignature(ClassInfo classInfo, ClassInfo superclass, ClassInfoList interfaces) Constructor used to create synthetic class type descriptor (#662).privateClassTypeSignature(ClassInfo classInfo, List<TypeParameter> typeParameters, ClassRefTypeSignature superclassSignature, List<ClassRefTypeSignature> superinterfaceSignatures, List<ClassRefOrTypeVariableSignature> throwsSignatures) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddTypeAnnotation(List<Classfile.TypePathNode> typePath, AnnotationInfo annotationInfo) Add a type annotation.booleanprotected voidfindReferencedClassInfo(Map<String, ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, LogNode log) GetClassInfoobjects for any classes referenced in the type descriptor or type signature.protected voidfindReferencedClassNames(Set<String> refdClassNames) Get the names of any classes referenced in the type signature.protected ClassInfoGet theClassInfoobject for the referenced class, or null if the referenced class was not encountered during scanning (i.e.protected StringThe name of the class (used byScanResultObject.getClassInfo()to fetch theClassInfoobject for the class).Get the type signature for the superclass (possibly null in the case ofObject, since it doesn't have a superclass).Get the type signatures of any superinterfaces.(package private) List<ClassRefOrTypeVariableSignature> Gets the throws signatures.Get the type parameters for the class.inthashCode()(package private) static ClassTypeSignatureParse a class type signature or class type descriptor.(package private) voidsetScanResult(ScanResult scanResult) Set ScanResult backreferences in info objects after scan has completed.protected voidtoStringInternal(boolean useSimpleNames, AnnotationInfoList annotationsToExclude, StringBuilder buf) To string internal.(package private) voidtoStringInternal(String className, boolean useSimpleNames, int modifiers, boolean isAnnotation, boolean isInterface, AnnotationInfoList annotationsToExclude, StringBuilder buf) Render into String form.Methods inherited from class HierarchicalTypeSignature
addTypeAnnotation, getTypeAnnotationInfo, toStringMethods inherited from class ScanResultObject
findReferencedClassInfo, loadClass, loadClass, loadClass, loadClass, toString, toString, toStringWithSimpleNames
-
Field Details
-
classInfo
The class info. -
typeParameters
The class type parameters. -
superclassSignature
The superclass type. -
superinterfaceSignatures
The superinterface signatures. -
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- theClassInfoobject 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
Get the type parameters for the class.- Returns:
- The type parameters for the class.
-
getSuperclassSignature
-
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:HierarchicalTypeSignatureAdd a type annotation.- Specified by:
addTypeAnnotationin classHierarchicalTypeSignature- Parameters:
typePath- the type pathannotationInfo- the annotation
-
getClassName
Description copied from class:ScanResultObjectThe name of the class (used byScanResultObject.getClassInfo()to fetch theClassInfoobject for the class).- Specified by:
getClassNamein classScanResultObject- Returns:
- The class name.
-
getClassInfo
Description copied from class:ScanResultObjectGet theClassInfoobject 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:
getClassInfoin classScanResultObject- Returns:
- The
ClassInfoobject for the referenced class.
-
setScanResult
Description copied from class:ScanResultObjectSet ScanResult backreferences in info objects after scan has completed.- Overrides:
setScanResultin classHierarchicalTypeSignature- Parameters:
scanResult- the scan result
-
findReferencedClassNames
-
findReferencedClassInfo
protected void findReferencedClassInfo(Map<String, ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, LogNode log) GetClassInfoobjects for any classes referenced in the type descriptor or type signature.- Overrides:
findReferencedClassInfoin classScanResultObject- Parameters:
classNameToClassInfo- the map from class name toClassInfo.refdClassInfo- the referenced class infolog- the log
-
hashCode
-
equals
-
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 nameuseSimpleNames- the use simple namesmodifiers- The class modifiers.isAnnotation- True if the class is an annotation.isInterface- True if the class is an interface.annotationsToExclude- the annotations to excludebuf- the buf
-
toStringInternal
protected void toStringInternal(boolean useSimpleNames, AnnotationInfoList annotationsToExclude, StringBuilder buf) To string internal.- Specified by:
toStringInternalin classHierarchicalTypeSignature- Parameters:
useSimpleNames- the use simple namesannotationsToExclude- the annotations to excludebuf- the buf
-
parse
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.
-