Package edu.umd.cs.findbugs.ba
Interface XMethod
- All Superinterfaces:
AccessibleEntity
,AnnotatedObject
,ClassMember
,Comparable<ComparableMethod>
,ComparableMethod
,FieldOrMethodName
,Serializable
- All Known Implementing Classes:
AbstractMethod
,MethodInfo
An XMethod represents symbolic information about a particular method.
If the resolved() method returns true, then any information queried from this object can be assumed to be accurate. If the resolved() method returns false, then FindBugs can't find the method and any information other than name/signature/etc. cannot be trusted.
- Author:
- David Hovemeyer, Bill Pugh
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnnotation
(AnnotationValue annotationValue) Destructively add an annotation.void
addParameterAnnotation
(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.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.int
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.String[]
boolean
boolean
boolean
isBridge()
Is this a bridge method?boolean
Is this an identity methodboolean
isNative()
boolean
boolean
isStub()
boolean
boolean
boolean
boolean
boolean
isVariableSynthetic
(int param) Is the variable synthetic?boolean
boolean
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, getContainingScope, getElementType, isSynthetic
Methods inherited from interface edu.umd.cs.findbugs.ba.ClassMember
getClassName, getName, getPackageName, getSignature, getSourceSignature, isResolved
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface edu.umd.cs.findbugs.classfile.FieldOrMethodName
getClassDescriptor, isStatic
-
Method Details
-
isNative
boolean isNative() -
isAbstract
boolean isAbstract() -
isSynchronized
boolean isSynchronized() -
getNumParams
int getNumParams() -
getMethodDescriptor
MethodDescriptor getMethodDescriptor()- Returns:
- the MethodDescriptor identifying this object
-
getThrownExceptions
String[] getThrownExceptions()- Returns:
- the exceptions this method is declared to throw
-
isUnconditionalThrower
boolean isUnconditionalThrower()- Returns:
- does this method unconditionally throw an exception?
-
usesConcurrency
boolean usesConcurrency()- Returns:
- does the method directly make use of concurrency/threads/synchronization?
-
isStub
boolean isStub()- Returns:
- is the method a synthetic stub method?
-
isIdentity
boolean isIdentity()Is this an identity method -
bridgeTo
If 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. -
bridgeFrom
-
getAccessMethodForMethod
-
getAccessMethodForField
-
resolveAccessMethodForMethod
XMethod resolveAccessMethodForMethod() -
isUnsupported
boolean isUnsupported()- Returns:
- does this method unconditionally throw an UnsupportedOperationException?
-
isVarArgs
boolean isVarArgs()- Returns:
- is this a var args method?
-
isReturnTypeReferenceType
boolean isReturnTypeReferenceType()- Returns:
- true if method's return type is a reference type, false otherwise
-
isBridge
boolean isBridge()Is this a bridge method? -
getParameterAnnotationDescriptors
Get ClassDescriptors (annotation classes) of annotations applied directly to this method's parameters.- Parameters:
param
- parameter number (0 for first parameter)- Returns:
- ClassDescriptors of annotations applied directly to this method's parameters
-
getParameterAnnotation
Get the AnnotationValue of annotation applied directly to given parameter.- 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
Get collection of all AnnotationValues applied directly to given parameter.- Parameters:
param
- parameter number (0 for first parameter)- Returns:
- Collection of all AnnotationValues applied directly to given parameter
-
hasParameterAnnotations
boolean hasParameterAnnotations() -
getAnnotationDescriptors
Collection<ClassDescriptor> getAnnotationDescriptors()Get ClassDescriptors (annotation classes) of annotations applied directly to this method.- Specified by:
getAnnotationDescriptors
in interfaceAnnotatedObject
- Returns:
- ClassDescriptors of annotations applied directly to this method
-
getAnnotation
Get the AnnotationValue of annotation applied directly to the method.- Specified by:
getAnnotation
in interfaceAnnotatedObject
- 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
Collection<AnnotationValue> getAnnotations()Get collection of all AnnotationValues applied directly to the method.- Specified by:
getAnnotations
in interfaceAnnotatedObject
- Returns:
- Collection of all AnnotationValues applied directly to the method
-
addParameterAnnotation
Destructively add a parameter annotation.- Parameters:
param
- parameter (0 == first parameter)annotationValue
- an AnnotationValue representing a parameter annotation
-
isVariableSynthetic
boolean isVariableSynthetic(int param) Is the variable synthetic? -
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.)- Parameters:
annotationValue
- an AnnotationValue representing a method annotation
-
usesInvokeDynamic
boolean usesInvokeDynamic()
-