Class ClassInfo
- java.lang.Object
-
- edu.umd.cs.findbugs.classfile.ClassDescriptor
-
- edu.umd.cs.findbugs.classfile.analysis.ClassNameAndSuperclassInfo
-
- edu.umd.cs.findbugs.classfile.analysis.ClassInfo
-
- All Implemented Interfaces:
AccessibleEntity,XClass,AnnotatedObject,java.io.Serializable,java.lang.Comparable<ClassDescriptor>
public class ClassInfo extends ClassNameAndSuperclassInfo implements XClass
ClassInfo represents important metadata about a loaded class, such as its superclass, access flags, codebase entry, etc.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClassInfo.Builder
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Map<ClassDescriptor,AnnotationValue>classAnnotationsprivate java.lang.StringclassSourceSignature(package private) AnnotatedObjectcontainingScopeprivate booleancontainingScopeCachedprivate static booleanDEBUGprivate booleanhasStubsprivate ClassDescriptorimmediateEnclosingClassprivate MethodInfo[]methodsInCallOrderprivate java.util.Map<java.lang.String,java.util.Map<java.lang.String,MethodInfo>>polymorphicMethodsThe class' polymorphic methods, indexed by name and signature.private java.lang.Stringsourceprivate booleanusesConcurrencyprivate FieldInfo[]xFieldsprivate MethodInfo[]xMethods-
Fields inherited from class edu.umd.cs.findbugs.classfile.ClassDescriptor
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description privateClassInfo(ClassDescriptor classDescriptor, java.lang.String classSourceSignature, ClassDescriptor superclassDescriptor, ClassDescriptor[] interfaceDescriptorList, ICodeBaseEntry codeBaseEntry, int accessFlags, java.lang.String source, int majorVersion, int minorVersion, java.util.Collection<ClassDescriptor> referencedClassDescriptorList, java.util.Set<ClassDescriptor> calledClassDescriptors, java.util.Map<ClassDescriptor,AnnotationValue> classAnnotations, FieldInfo[] fieldDescriptorList, MethodInfo[] methodInfoList, ClassDescriptor immediateEnclosingClass, boolean usesConcurrency, boolean hasStubs, java.util.Map<java.lang.String,java.util.Map<java.lang.String,MethodInfo>> polymorphicMethods)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(AnnotationValue annotationValue)Destructively add an annotation to the object.private MethodInfo[]computeMethodsInCallOrder()XFieldfindField(java.lang.String name, java.lang.String signature, boolean isStatic)Find an XField matching given parameters.XMethodfindMatchingMethod(MethodDescriptor descriptor)Find XMethod matching the name and signature of the supplied method MethodDescriptor.XMethodfindMethod(MethodDescriptor descriptor)Find XMethod matching given MethodDescriptor.XMethodfindMethod(java.lang.String methodName, java.lang.String methodSig, boolean isStatic)Find an XMethod matching given parameters.AnnotationValuegetAnnotation(ClassDescriptor desc)java.util.Collection<ClassDescriptor>getAnnotationDescriptors()java.util.Collection<AnnotationValue>getAnnotations()AnnotatedObjectgetContainingScope()AnnotatedObjectgetContainingScope0()java.lang.annotation.ElementTypegetElementType()ClassDescriptorgetImmediateEnclosingClass()Get the ClassDescriptor of the immediate enclosing class, or null if this XClass is not a nested or inner class.java.lang.StringgetPackageName()Get the name of the package in dotted format.java.lang.StringgetSlashedPackageName()java.lang.StringgetSource()java.lang.StringgetSourceSignature()java.util.List<? extends XField>getXFields()java.util.List<? extends XMethod>getXMethods()java.util.List<? extends XMethod>getXMethodsInCallOrder()booleanhasStubs()booleanusesConcurrency()-
Methods inherited from class edu.umd.cs.findbugs.classfile.analysis.ClassNameAndSuperclassInfo
getAccessFlags, getCalledClassDescriptors, getClassDescriptor, getCodeBaseEntry, getInterfaceDescriptorList, getMajorVersion, getMinorVersion, getSuperclassDescriptor, isAbstract, isAnnotation, isDeprecated, isFinal, isInterface, isPrivate, isProtected, isPublic, isStatic, isSynthetic
-
Methods inherited from class edu.umd.cs.findbugs.classfile.ClassDescriptor
compareTo, createClassDescriptor, createClassDescriptor, createClassDescriptor, createClassDescriptorFromDottedClassName, createClassDescriptorFromSignature, equals, fromFieldSignature, fromResourceName, getClassName, getDottedClassName, getSignature, getSimpleName, getXClass, hashCode, isAnonymousClass, isArray, isClassResource, matches, throwClassNotFoundException, toDottedClassName, toResourceName, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface edu.umd.cs.findbugs.ba.AccessibleEntity
getAccessFlags, getClassDescriptor, isDeprecated, isFinal, isPrivate, isProtected, isPublic, isStatic, isSynthetic
-
Methods inherited from interface edu.umd.cs.findbugs.classfile.analysis.AnnotatedObject
getClassDescriptor, isSynthetic
-
Methods inherited from interface edu.umd.cs.findbugs.ba.XClass
getCalledClassDescriptors, getInterfaceDescriptorList, getSuperclassDescriptor, isAbstract, isInterface
-
-
-
-
Field Detail
-
DEBUG
private static final boolean DEBUG
-
xFields
private final FieldInfo[] xFields
-
xMethods
private final MethodInfo[] xMethods
-
methodsInCallOrder
private final MethodInfo[] methodsInCallOrder
-
immediateEnclosingClass
private final ClassDescriptor immediateEnclosingClass
-
classAnnotations
java.util.Map<ClassDescriptor,AnnotationValue> classAnnotations
-
classSourceSignature
private final java.lang.String classSourceSignature
-
source
private final java.lang.String source
-
usesConcurrency
private final boolean usesConcurrency
-
hasStubs
private final boolean hasStubs
-
containingScope
@CheckForNull AnnotatedObject containingScope
-
containingScopeCached
private boolean containingScopeCached
-
polymorphicMethods
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,MethodInfo>> polymorphicMethods
The class' polymorphic methods, indexed by name and signature. SeeMethodHandlewhich is a special case where a method has multiple signatures. The methods are assumed to be non-static.
-
-
Constructor Detail
-
ClassInfo
private ClassInfo(ClassDescriptor classDescriptor, java.lang.String classSourceSignature, ClassDescriptor superclassDescriptor, ClassDescriptor[] interfaceDescriptorList, ICodeBaseEntry codeBaseEntry, int accessFlags, java.lang.String source, int majorVersion, int minorVersion, java.util.Collection<ClassDescriptor> referencedClassDescriptorList, java.util.Set<ClassDescriptor> calledClassDescriptors, java.util.Map<ClassDescriptor,AnnotationValue> classAnnotations, FieldInfo[] fieldDescriptorList, MethodInfo[] methodInfoList, ClassDescriptor immediateEnclosingClass, boolean usesConcurrency, boolean hasStubs, java.util.Map<java.lang.String,java.util.Map<java.lang.String,MethodInfo>> polymorphicMethods)
- Parameters:
classDescriptor- ClassDescriptor representing the class namesuperclassDescriptor- ClassDescriptor representing the superclass nameinterfaceDescriptorList- ClassDescriptors representing implemented interface namescodeBaseEntry- codebase entry class was loaded fromaccessFlags- class's access flagsreferencedClassDescriptorList- ClassDescriptors of all classes/interfaces referenced by the classfieldDescriptorList- FieldDescriptors of fields defined in the classmethodInfoList- MethodDescriptors of methods defined in the class
-
-
Method Detail
-
computeMethodsInCallOrder
private MethodInfo[] computeMethodsInCallOrder()
-
getXFields
public java.util.List<? extends XField> getXFields()
- Specified by:
getXFieldsin interfaceXClass
-
getXMethods
public java.util.List<? extends XMethod> getXMethods()
- Specified by:
getXMethodsin interfaceXClass
-
getXMethodsInCallOrder
public java.util.List<? extends XMethod> getXMethodsInCallOrder()
-
findMethod
public XMethod findMethod(java.lang.String methodName, java.lang.String methodSig, boolean isStatic)
Description copied from interface:XClassFind an XMethod matching given parameters.- Specified by:
findMethodin interfaceXClass- Parameters:
methodName- name of the methodmethodSig- signature of the methodisStatic- true if the method is static, false if not- Returns:
- matching XMethod, or null if there is no matching XMethod
-
findMethod
public XMethod findMethod(MethodDescriptor descriptor)
Description copied from interface:XClassFind XMethod matching given MethodDescriptor.- Specified by:
findMethodin interfaceXClass- Parameters:
descriptor- a MethodDescriptor- Returns:
- matching XMethod, or null if there is no matching method
-
findMatchingMethod
public XMethod findMatchingMethod(MethodDescriptor descriptor)
Description copied from interface:XClassFind XMethod matching the name and signature of the supplied method MethodDescriptor. The class descriptor of the argument is ignored.- Specified by:
findMatchingMethodin interfaceXClass- Parameters:
descriptor- a MethodDescriptor- Returns:
- matching XMethod, or null if there is no matching method
-
findField
public XField findField(java.lang.String name, java.lang.String signature, boolean isStatic)
Description copied from interface:XClassFind an XField matching given parameters.
-
getImmediateEnclosingClass
public ClassDescriptor getImmediateEnclosingClass()
Description copied from interface:XClassGet the ClassDescriptor of the immediate enclosing class, or null if this XClass is not a nested or inner class.- Specified by:
getImmediateEnclosingClassin interfaceXClass- Returns:
- the ClassDescriptor of the immediate enclosing class, or null if this XClass is not a nested or inner class
-
getPackageName
public java.lang.String getPackageName()
Description copied from class:ClassDescriptorGet the name of the package in dotted format.- Overrides:
getPackageNamein classClassDescriptor- Returns:
- the name of the package in dotted format
-
getSlashedPackageName
public java.lang.String getSlashedPackageName()
-
getAnnotationDescriptors
public java.util.Collection<ClassDescriptor> getAnnotationDescriptors()
- Specified by:
getAnnotationDescriptorsin interfaceAnnotatedObject- Specified by:
getAnnotationDescriptorsin interfaceXClass
-
getAnnotations
public java.util.Collection<AnnotationValue> getAnnotations()
- Specified by:
getAnnotationsin interfaceAnnotatedObject
-
getAnnotation
public AnnotationValue getAnnotation(ClassDescriptor desc)
- Specified by:
getAnnotationin interfaceAnnotatedObject- Specified by:
getAnnotationin interfaceXClass
-
addAnnotation
public void addAnnotation(AnnotationValue annotationValue)
Destructively add an annotation to the object. In general, this is not a great idea, since it could cause the same class to appear to have different annotations at different times. However, this method is necessary for "built-in" annotations that FindBugs adds to system classes. As long as we add such annotations early enough that nobody will notice, we should be ok.- Parameters:
annotationValue- an AnnotationValue to add to the class
-
getElementType
public java.lang.annotation.ElementType getElementType()
- Specified by:
getElementTypein interfaceAnnotatedObject
-
getSource
@CheckForNull public java.lang.String getSource()
-
getContainingScope
@CheckForNull public AnnotatedObject getContainingScope()
- Specified by:
getContainingScopein interfaceAnnotatedObject
-
getContainingScope0
@CheckForNull public AnnotatedObject getContainingScope0()
-
getSourceSignature
public java.lang.String getSourceSignature()
- Specified by:
getSourceSignaturein interfaceXClass
-
usesConcurrency
public boolean usesConcurrency()
- Specified by:
usesConcurrencyin interfaceXClass
-
-