Package edu.umd.cs.findbugs.ba
Interface XMethod
-
- All Superinterfaces:
AccessibleEntity
,AnnotatedObject
,ClassMember
,java.lang.Comparable<ComparableMethod>
,ComparableMethod
,FieldOrMethodName
,java.io.Serializable
- All Known Implementing Classes:
AbstractMethod
,MethodInfo
public interface XMethod extends ClassMember, AnnotatedObject, ComparableMethod
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAnnotation(AnnotationValue annotationValue)
Destructively add an annotation.void
addParameterAnnotation(int param, AnnotationValue annotationValue)
Destructively add a parameter annotation.XMethod
bridgeFrom()
XMethod
bridgeTo()
If nonnull, then this method is a synthetic method that overrides a method in a superclass.FieldDescriptor
getAccessMethodForField()
MethodDescriptor
getAccessMethodForMethod()
AnnotationValue
getAnnotation(ClassDescriptor desc)
Get the AnnotationValue of annotation applied directly to the method.java.util.Collection<ClassDescriptor>
getAnnotationDescriptors()
Get ClassDescriptors (annotation classes) of annotations applied directly to this method.java.util.Collection<AnnotationValue>
getAnnotations()
Get collection of all AnnotationValues applied directly to the method.MethodDescriptor
getMethodDescriptor()
int
getNumParams()
AnnotationValue
getParameterAnnotation(int param, ClassDescriptor desc)
Get the AnnotationValue of annotation applied directly to given parameter.java.util.Collection<ClassDescriptor>
getParameterAnnotationDescriptors(int param)
Get ClassDescriptors (annotation classes) of annotations applied directly to this method's parameters.java.util.Collection<AnnotationValue>
getParameterAnnotations(int param)
Get collection of all AnnotationValues applied directly to given parameter.java.lang.String[]
getThrownExceptions()
boolean
hasParameterAnnotations()
boolean
isAbstract()
boolean
isBridge()
Is this a bridge method?boolean
isIdentity()
Is this an identity methodboolean
isNative()
boolean
isReturnTypeReferenceType()
boolean
isStub()
boolean
isSynchronized()
boolean
isUnconditionalThrower()
boolean
isUnsupported()
boolean
isVarArgs()
boolean
isVariableSynthetic(int param)
Is the variable synthetic?XMethod
resolveAccessMethodForMethod()
boolean
usesConcurrency()
boolean
usesInvokeDynamic()
-
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 edu.umd.cs.findbugs.classfile.FieldOrMethodName
getClassDescriptor, isStatic
-
-
-
-
Method Detail
-
isNative
boolean isNative()
-
isAbstract
boolean isAbstract()
-
isSynchronized
boolean isSynchronized()
-
getNumParams
int getNumParams()
-
getMethodDescriptor
MethodDescriptor getMethodDescriptor()
- Returns:
- the MethodDescriptor identifying this object
-
getThrownExceptions
java.lang.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
@CheckForNull XMethod 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
@CheckForNull XMethod bridgeFrom()
-
getAccessMethodForMethod
@CheckForNull MethodDescriptor getAccessMethodForMethod()
-
getAccessMethodForField
@CheckForNull FieldDescriptor 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
java.util.Collection<ClassDescriptor> getParameterAnnotationDescriptors(int param)
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
@CheckForNull AnnotationValue getParameterAnnotation(int param, ClassDescriptor desc)
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
java.util.Collection<AnnotationValue> getParameterAnnotations(int param)
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
java.util.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
AnnotationValue getAnnotation(ClassDescriptor desc)
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
java.util.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
void addParameterAnnotation(int param, AnnotationValue annotationValue)
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
void addAnnotation(AnnotationValue annotationValue)
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()
-
-