Class MethodInfo
java.lang.Object
edu.umd.cs.findbugs.classfile.FieldOrMethodDescriptor
edu.umd.cs.findbugs.classfile.MethodDescriptor
edu.umd.cs.findbugs.classfile.analysis.MethodInfo
- All Implemented Interfaces:
AccessibleEntity, ClassMember, ComparableMethod, XMethod, AnnotatedObject, FieldOrMethodName, Serializable, Comparable<ComparableMethod>
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final intstatic final MethodInfo[](package private) final String[](package private) final boolean(package private) final boolean(package private) final boolean(package private) Map<ClassDescriptor, AnnotationValue> (package private) final int(package private) Map<Integer, Map<ClassDescriptor, AnnotationValue>> (package private) final String(package private) final boolean(package private) final long -
Constructor Summary
ConstructorsConstructorDescriptionMethodInfo(String className, String methodName, String methodSignature, String methodSourceSignature, int accessFlags, boolean isUnconditionalThrower, boolean isUnsupported, boolean usesConcurrency, boolean hasBackBranch, boolean isStub, boolean isIdentity, boolean usesInvokeDynamic, int methodCallCount, String[] exceptions, MethodDescriptor accessMethodForMethod, FieldDescriptor accessMethodForField, Map<ClassDescriptor, AnnotationValue> methodAnnotations, Map<Integer, Map<ClassDescriptor, AnnotationValue>> methodParameterAnnotations, long variableIsSynthetic) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotation(AnnotationValue annotationValue) Destructively add an annotation.voidaddParameterAnnotation(int param, AnnotationValue annotationValue) Destructively add a parameter annotation.bridgeTo()If nonnull, then this method is a synthetic method that overrides a method in a superclass.private booleancheckFlag(int flag) intprivate booleancomputeHasPolymorphicSignature(Map<ClassDescriptor, AnnotationValue> methodAnnotations) intGet the entity's access flags.(package private) static IdentityHashMap<MethodInfo, FieldDescriptor> (package private) static IdentityHashMap<MethodInfo, MethodDescriptor> getAnnotation(ClassDescriptor desc) Get the AnnotationValue of annotation applied directly to the method.Get ClassDescriptors (annotation classes) of annotations applied directly to this method.Get collection of all AnnotationValues applied directly to the method.Get the full (dotted) name of the class (if the object represents a class) or the class the entity is defined in (if a field or method).(package private) static MethodInfo.MethodInfoDatabase(package private) static IdentityHashMap<MethodInfo, Void> static IdentityHashMap<MethodInfo, Void> intintGet the (dotted) name of the package in which the entity is defined.getParameterAnnotation(int param, ClassDescriptor desc) Get the AnnotationValue of annotation applied directly to given parameter.getParameterAnnotationDescriptors(int param) Get ClassDescriptors (annotation classes) of annotations applied directly to this method's parameters.getParameterAnnotations(int param) Get collection of all AnnotationValues applied directly to given parameter.Get the signature representing the field/method's type, including generic typeString[](package private) static IdentityHashMap<MethodInfo, Void> (package private) static IdentityHashMap<MethodInfo, Void> booleanbooleanbooleanSeejava.lang.invoke.MethodHandle.PolymorphicSignaturebooleanbooleanisBridge()Is this a bridge method?booleanIs the entity deprecated?booleanisFinal()Is the entity final?booleanIs this an identity methodbooleanisNative()booleanIs the entity private?booleanIs the entity protected?booleanisPublic()Is the entity public?booleanDid we find a declaration of this entity?booleanbooleanisStub()booleanbooleanIs the entity synthetic?booleanbooleanbooleanbooleanisVariableSynthetic(int param) Is the variable synthetic?static MethodInfo[]newArray(int sz) booleanbooleanwithSignature(String otherMethodSignature) Methods inherited from class MethodDescriptor
equals, isAccessMethodMethods inherited from class FieldOrMethodDescriptor
compareTo, compareTo, getClassDescriptor, getName, getNameSigHashCode, getNameSigHashCode, getSignature, getSlashedClassName, hashCode, haveEqualFields, isStatic, toStringMethods inherited from interface AccessibleEntity
getClassDescriptor, isStaticMethods inherited from interface AnnotatedObject
getClassDescriptorMethods inherited from interface ClassMember
getName, getSignatureMethods inherited from interface FieldOrMethodName
getClassDescriptor, isStaticMethods inherited from interface XMethod
isAccessMethod
-
Field Details
-
EMPTY_ARRAY
-
accessFlags
final int accessFlags -
variableIsSynthetic
final long variableIsSynthetic -
methodCallCount
final int methodCallCount -
usesConcurrency
final boolean usesConcurrency -
hasBackBranch
final boolean hasBackBranch -
isStub
final boolean isStub -
hasPolymorphicSignature
final boolean hasPolymorphicSignature -
methodSourceSignature
-
exceptions
-
methodAnnotations
Map<ClassDescriptor, AnnotationValue> methodAnnotations -
methodParameterAnnotations
Map<Integer, Map<ClassDescriptor, AnnotationValue>> methodParameterAnnotations
-
-
Constructor Details
-
MethodInfo
MethodInfo(@SlashedClassName String className, String methodName, String methodSignature, String methodSourceSignature, int accessFlags, boolean isUnconditionalThrower, boolean isUnsupported, boolean usesConcurrency, boolean hasBackBranch, boolean isStub, boolean isIdentity, boolean usesInvokeDynamic, int methodCallCount, @CheckForNull String[] exceptions, @CheckForNull MethodDescriptor accessMethodForMethod, @CheckForNull FieldDescriptor accessMethodForField, Map<ClassDescriptor, AnnotationValue> methodAnnotations, Map<Integer, Map<ClassDescriptor, AnnotationValue>> methodParameterAnnotations, long variableIsSynthetic)
-
-
Method Details
-
newArray
-
getDatabase
- Returns:
- Returns the database.
-
getUnconditionalthrowers
-
getUnsupportedmethods
-
getAccessmethodformethod
-
getAccessmethodforfield
-
getIdentitymethods
-
getInvokeDynamicMethods
-
computeHasPolymorphicSignature
private boolean computeHasPolymorphicSignature(Map<ClassDescriptor, AnnotationValue> methodAnnotations) -
getThrownExceptions
- Specified by:
getThrownExceptionsin interfaceXMethod- Returns:
- the exceptions this method is declared to throw
-
isUnconditionalThrower
public boolean isUnconditionalThrower()- Specified by:
isUnconditionalThrowerin interfaceXMethod- Returns:
- does this method unconditionally throw an exception?
-
isIdentity
public boolean isIdentity()Description copied from interface:XMethodIs this an identity method- Specified by:
isIdentityin interfaceXMethod
-
usesInvokeDynamic
public boolean usesInvokeDynamic()- Specified by:
usesInvokeDynamicin interfaceXMethod
-
isUnsupported
public boolean isUnsupported()- Specified by:
isUnsupportedin interfaceXMethod- Returns:
- does this method unconditionally throw an UnsupportedOperationException?
-
getNumParams
public int getNumParams()- Specified by:
getNumParamsin interfaceXMethod
-
isVariableSynthetic
public boolean isVariableSynthetic(int param) Description copied from interface:XMethodIs the variable synthetic?- Specified by:
isVariableSyntheticin interfaceXMethod
-
getMethodCallCount
public int getMethodCallCount() -
checkFlag
private boolean checkFlag(int flag) -
isNative
-
isAbstract
public boolean isAbstract()- Specified by:
isAbstractin interfaceXMethod
-
isSynchronized
public boolean isSynchronized()- Specified by:
isSynchronizedin interfaceXMethod
-
isBridge
-
isReturnTypeReferenceType
public boolean isReturnTypeReferenceType()- Specified by:
isReturnTypeReferenceTypein interfaceXMethod- Returns:
- true if method's return type is a reference type, false otherwise
-
getClassName
Description copied from interface:ClassMemberGet the full (dotted) name of the class (if the object represents a class) or the class the entity is defined in (if a field or method).- Specified by:
getClassNamein interfaceClassMember
-
getPackageName
Description copied from interface:ClassMemberGet the (dotted) name of the package in which the entity is defined.- Specified by:
getPackageNamein interfaceClassMember
-
getSourceSignature
Description copied from interface:ClassMemberGet the signature representing the field/method's type, including generic type- Specified by:
getSourceSignaturein interfaceClassMember
-
compareTo
- Specified by:
compareToin interfaceComparable<ComparableMethod>- Overrides:
compareToin classMethodDescriptor
-
getAccessFlags
public int getAccessFlags()Description copied from interface:AccessibleEntityGet the entity's access flags.- Specified by:
getAccessFlagsin interfaceAccessibleEntity
-
isFinal
public boolean isFinal()Description copied from interface:AccessibleEntityIs the entity final?- Specified by:
isFinalin interfaceAccessibleEntity
-
isPrivate
public boolean isPrivate()Description copied from interface:AccessibleEntityIs the entity private?- Specified by:
isPrivatein interfaceAccessibleEntity
-
isDeprecated
public boolean isDeprecated()Description copied from interface:AccessibleEntityIs the entity deprecated?- Specified by:
isDeprecatedin interfaceAccessibleEntity
-
isProtected
public boolean isProtected()Description copied from interface:AccessibleEntityIs the entity protected?- Specified by:
isProtectedin interfaceAccessibleEntity
-
isPublic
public boolean isPublic()Description copied from interface:AccessibleEntityIs the entity public?- Specified by:
isPublicin interfaceAccessibleEntity
-
isSynthetic
public boolean isSynthetic()Description copied from interface:AccessibleEntityIs the entity synthetic?- Specified by:
isSyntheticin interfaceAccessibleEntity- Specified by:
isSyntheticin interfaceAnnotatedObject
-
isResolved
public boolean isResolved()Description copied from interface:ClassMemberDid we find a declaration of this entity?- Specified by:
isResolvedin interfaceClassMember
-
getParameterAnnotationDescriptors
Description copied from interface:XMethodGet ClassDescriptors (annotation classes) of annotations applied directly to this method's parameters.- Specified by:
getParameterAnnotationDescriptorsin interfaceXMethod- Parameters:
param- parameter number (0 for first parameter)- Returns:
- ClassDescriptors of annotations applied directly to this method's parameters
-
hasParameterAnnotations
public boolean hasParameterAnnotations()- Specified by:
hasParameterAnnotationsin interfaceXMethod
-
getParameterAnnotation
Description copied from interface:XMethodGet the AnnotationValue of annotation applied directly to given parameter.- Specified by:
getParameterAnnotationin interfaceXMethod- Parameters:
param- parameter number (0 for first parameter)desc- ClassDescriptor of the annotation class- Returns:
- AnnotationValue annotating the parameter, or null if parameter is not annotated with this kind of annotation
-
getParameterAnnotations
Description copied from interface:XMethodGet collection of all AnnotationValues applied directly to given parameter.- Specified by:
getParameterAnnotationsin interfaceXMethod- Parameters:
param- parameter number (0 for first parameter)- Returns:
- Collection of all AnnotationValues applied directly to given parameter
-
getAnnotationDescriptors
Description copied from interface:XMethodGet ClassDescriptors (annotation classes) of annotations applied directly to this method.- Specified by:
getAnnotationDescriptorsin interfaceAnnotatedObject- Specified by:
getAnnotationDescriptorsin interfaceXMethod- Returns:
- ClassDescriptors of annotations applied directly to this method
-
getAnnotation
Description copied from interface:XMethodGet the AnnotationValue of annotation applied directly to the method.- Specified by:
getAnnotationin interfaceAnnotatedObject- Specified by:
getAnnotationin interfaceXMethod- Parameters:
desc- ClassDescriptor of the annotation class- Returns:
- AnnotationValue annotating the method, or null if method is not annotated with this kind of annotation
-
getAnnotations
Description copied from interface:XMethodGet collection of all AnnotationValues applied directly to the method.- Specified by:
getAnnotationsin interfaceAnnotatedObject- Specified by:
getAnnotationsin interfaceXMethod- Returns:
- Collection of all AnnotationValues applied directly to the method
-
addAnnotation
Destructively add an annotation. We do this for "built-in" annotations that might not be directly evident in the code. It's not a great idea in general, but we can get away with it as long as it's done early enough (i.e., before anyone asks what annotations this method has.)- Specified by:
addAnnotationin interfaceXMethod- Parameters:
annotationValue- an AnnotationValue representing a method annotation
-
addParameterAnnotation
Destructively add a parameter annotation.- Specified by:
addParameterAnnotationin interfaceXMethod- Parameters:
param- parameter (0 == first parameter)annotationValue- an AnnotationValue representing a parameter annotation
-
getMethodDescriptor
- Specified by:
getMethodDescriptorin interfaceXMethod- Returns:
- the MethodDescriptor identifying this object
-
getElementType
- Specified by:
getElementTypein interfaceAnnotatedObject
-
getContainingScope
- Specified by:
getContainingScopein interfaceAnnotatedObject
-
isVarArgs
-
usesConcurrency
public boolean usesConcurrency()- Specified by:
usesConcurrencyin interfaceXMethod- Returns:
- does the method directly make use of concurrency/threads/synchronization?
-
hasBackBranch
public boolean hasBackBranch() -
isStub
-
getAccessMethodForMethod
- Specified by:
getAccessMethodForMethodin interfaceXMethod
-
getAccessMethodForField
- Specified by:
getAccessMethodForFieldin interfaceXMethod
-
bridgeFrom
- Specified by:
bridgeFromin interfaceXMethod
-
bridgeTo
Description copied from interface:XMethodIf nonnull, then this method is a synthetic method that overrides a method in a superclass. This method simply forwards the call to the method it bridges to, which is a method with an identical name but possibly co-variant arguments and return values. -
resolveAccessMethodForMethod
- Specified by:
resolveAccessMethodForMethodin interfaceXMethod
-
hasPolymorphicSignature
public boolean hasPolymorphicSignature()Description copied from interface:XMethodSeejava.lang.invoke.MethodHandle.PolymorphicSignature- Specified by:
hasPolymorphicSignaturein interfaceXMethod- Returns:
- is this method polymorphic as defined in
MethodHandle
-
withSignature
- Parameters:
otherMethodSignature- A method signature, for instance ()Ljava/lang/Object;- Returns:
- a new
MethodInfowith the given signature
-