FindBugs™ 1.3.9

edu.umd.cs.findbugs.classfile.analysis
Class MethodInfo

java.lang.Object
  extended by edu.umd.cs.findbugs.classfile.FieldOrMethodDescriptor
      extended by edu.umd.cs.findbugs.classfile.MethodDescriptor
          extended by edu.umd.cs.findbugs.classfile.analysis.MethodInfo
All Implemented Interfaces:
AccessibleEntity, ClassMember, XMethod, AnnotatedObject, FieldOrMethodName, java.io.Serializable, java.lang.Comparable

public class MethodInfo
extends MethodDescriptor
implements XMethod, AnnotatedObject

Author:
pugh
See Also:
Serialized Form

Nested Class Summary
static class MethodInfo.Builder
           
 
Field Summary
static MethodInfo[] EMPTY_ARRAY
           
 
Method Summary
 void addAnnotation(AnnotationValue annotationValue)
          Destructively add an annotation.
 void addParameterAnnotation(int param, AnnotationValue annotationValue)
          Destructively add a parameter annotation.
 int compareTo(java.lang.Object rhs)
           
 int getAccessFlags()
          Get the entity's access flags.
 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.
 java.lang.String getClassName()
          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).
 AnnotatedObject getContainingScope()
           
 java.lang.annotation.ElementType getElementType()
           
 MethodDescriptor getMethodDescriptor()
           
 int getNumParams()
           
 java.lang.String getPackageName()
          Get the (dotted) name of the package in which the entity is defined.
 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 getSourceSignature()
          Get the signature representing the field/method's type, including generic type
 java.lang.String[] getThrownExceptions()
           
 boolean isAbstract()
           
 boolean isDeprecated()
          Is the entity deprecated?
 boolean isFinal()
          Is the entity final?
 boolean isNative()
           
 boolean isPrivate()
          Is the entity private?
 boolean isProtected()
          Is the entity protected?
 boolean isPublic()
          Is the entity public?
 boolean isResolved()
          Did we find a declaration of this entity?
 boolean isReturnTypeReferenceType()
           
 boolean isStub()
           
 boolean isSynchronized()
           
 boolean isSynthetic()
          Is the entity synthetic?
 boolean isUnconditionalThrower()
           
 boolean isUnsupported()
           
 boolean isVarArgs()
           
 boolean usesConcurrency()
           
 
Methods inherited from class edu.umd.cs.findbugs.classfile.MethodDescriptor
getBridgeSignature, isBridged
 
Methods inherited from class edu.umd.cs.findbugs.classfile.FieldOrMethodDescriptor
compareTo, equals, getClassDescriptor, getName, getNameSigHashCode, getNameSigHashCode, getSignature, getSlashedClassName, hashCode, isStatic, 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.XMethod
getBridgeSignature, isBridged
 
Methods inherited from interface edu.umd.cs.findbugs.ba.ClassMember
getName, getSignature
 
Methods inherited from interface edu.umd.cs.findbugs.ba.AccessibleEntity
getClassDescriptor, isStatic
 
Methods inherited from interface edu.umd.cs.findbugs.classfile.FieldOrMethodName
getClassDescriptor, isStatic
 
Methods inherited from interface edu.umd.cs.findbugs.classfile.analysis.AnnotatedObject
getClassDescriptor
 

Field Detail

EMPTY_ARRAY

public static final MethodInfo[] EMPTY_ARRAY
Method Detail

getThrownExceptions

@CheckForNull
public java.lang.String[] getThrownExceptions()
Specified by:
getThrownExceptions in interface XMethod
Returns:
the exceptions this method is declared to throw

isUnconditionalThrower

public boolean isUnconditionalThrower()
Specified by:
isUnconditionalThrower in interface XMethod
Returns:
does this method unconditionally throw an exception?

isUnsupported

public boolean isUnsupported()
Specified by:
isUnsupported in interface XMethod
Returns:
does this method unconditionally throw an UnsupportedOperationException?

getNumParams

public int getNumParams()
Specified by:
getNumParams in interface XMethod

isNative

public boolean isNative()
Specified by:
isNative in interface XMethod

isAbstract

public boolean isAbstract()
Specified by:
isAbstract in interface XMethod

isSynchronized

public boolean isSynchronized()
Specified by:
isSynchronized in interface XMethod

isReturnTypeReferenceType

public boolean isReturnTypeReferenceType()
Specified by:
isReturnTypeReferenceType in interface XMethod
Returns:
true if method's return type is a reference type, false otherwise

getClassName

@DottedClassName
public java.lang.String getClassName()
Description copied from interface: ClassMember
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).

Specified by:
getClassName in interface ClassMember

getPackageName

@DottedClassName
public java.lang.String getPackageName()
Description copied from interface: ClassMember
Get the (dotted) name of the package in which the entity is defined.

Specified by:
getPackageName in interface ClassMember

getSourceSignature

public java.lang.String getSourceSignature()
Description copied from interface: ClassMember
Get the signature representing the field/method's type, including generic type

Specified by:
getSourceSignature in interface ClassMember

compareTo

public int compareTo(java.lang.Object rhs)
Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class FieldOrMethodDescriptor

getAccessFlags

public int getAccessFlags()
Description copied from interface: AccessibleEntity
Get the entity's access flags.

Specified by:
getAccessFlags in interface AccessibleEntity

isFinal

public boolean isFinal()
Description copied from interface: AccessibleEntity
Is the entity final?

Specified by:
isFinal in interface AccessibleEntity

isPrivate

public boolean isPrivate()
Description copied from interface: AccessibleEntity
Is the entity private?

Specified by:
isPrivate in interface AccessibleEntity

isDeprecated

public boolean isDeprecated()
Description copied from interface: AccessibleEntity
Is the entity deprecated?

Specified by:
isDeprecated in interface AccessibleEntity

isProtected

public boolean isProtected()
Description copied from interface: AccessibleEntity
Is the entity protected?

Specified by:
isProtected in interface AccessibleEntity

isPublic

public boolean isPublic()
Description copied from interface: AccessibleEntity
Is the entity public?

Specified by:
isPublic in interface AccessibleEntity

isSynthetic

public boolean isSynthetic()
Description copied from interface: AccessibleEntity
Is the entity synthetic?

Specified by:
isSynthetic in interface AccessibleEntity
Specified by:
isSynthetic in interface AnnotatedObject

isResolved

public boolean isResolved()
Description copied from interface: ClassMember
Did we find a declaration of this entity?

Specified by:
isResolved in interface ClassMember

getParameterAnnotationDescriptors

public java.util.Collection<ClassDescriptor> getParameterAnnotationDescriptors(int param)
Description copied from interface: XMethod
Get ClassDescriptors (annotation classes) of annotations applied directly to this method's parameters.

Specified by:
getParameterAnnotationDescriptors in interface XMethod
Parameters:
param - parameter number (0 for first parameter)
Returns:
ClassDescriptors of annotations applied directly to this method's parameters

getParameterAnnotation

@Nullable
public AnnotationValue getParameterAnnotation(int param,
                                                       ClassDescriptor desc)
Description copied from interface: XMethod
Get the AnnotationValue of annotation applied directly to given parameter.

Specified by:
getParameterAnnotation in interface XMethod
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

public java.util.Collection<AnnotationValue> getParameterAnnotations(int param)
Description copied from interface: XMethod
Get collection of all AnnotationValues applied directly to given parameter.

Specified by:
getParameterAnnotations in interface XMethod
Parameters:
param - parameter number (0 for first parameter)
Returns:
Collection of all AnnotationValues applied directly to given parameter

getAnnotationDescriptors

public java.util.Collection<ClassDescriptor> getAnnotationDescriptors()
Description copied from interface: XMethod
Get ClassDescriptors (annotation classes) of annotations applied directly to this method.

Specified by:
getAnnotationDescriptors in interface XMethod
Specified by:
getAnnotationDescriptors in interface AnnotatedObject
Returns:
ClassDescriptors of annotations applied directly to this method

getAnnotation

public AnnotationValue getAnnotation(ClassDescriptor desc)
Description copied from interface: XMethod
Get the AnnotationValue of annotation applied directly to the method.

Specified by:
getAnnotation in interface XMethod
Specified by:
getAnnotation in interface AnnotatedObject
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

public java.util.Collection<AnnotationValue> getAnnotations()
Description copied from interface: XMethod
Get collection of all AnnotationValues applied directly to the method.

Specified by:
getAnnotations in interface XMethod
Specified by:
getAnnotations in interface AnnotatedObject
Returns:
Collection of all AnnotationValues applied directly to the method

addAnnotation

public 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

addParameterAnnotation

public void addParameterAnnotation(int param,
                                   AnnotationValue annotationValue)
Destructively add a parameter annotation.

Parameters:
param - parameter (0 == first parameter)
annotationValue - an AnnotationValue representing a parameter annotation

getMethodDescriptor

public MethodDescriptor getMethodDescriptor()
Specified by:
getMethodDescriptor in interface XMethod
Returns:
the MethodDescriptor identifying this object

getElementType

public java.lang.annotation.ElementType getElementType()
Specified by:
getElementType in interface AnnotatedObject

getContainingScope

@CheckForNull
public AnnotatedObject getContainingScope()
Specified by:
getContainingScope in interface AnnotatedObject

isVarArgs

public boolean isVarArgs()
Specified by:
isVarArgs in interface XMethod
Returns:
is this a var args method?

usesConcurrency

public boolean usesConcurrency()
Specified by:
usesConcurrency in interface XMethod
Returns:
does the method directly make use of concurrency/threads/synchronization?

isStub

public boolean isStub()
Specified by:
isStub in interface XMethod
Returns:
is the method a synthetic stub method?

FindBugs™ 1.3.9

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.