Interface XMethod

All Superinterfaces:
AccessibleEntity, AnnotatedObject, ClassMember, Comparable<ComparableMethod>, ComparableMethod, FieldOrMethodName, 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 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

      @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

      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

      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

      Collection<ClassDescriptor> getAnnotationDescriptors()
      Get ClassDescriptors (annotation classes) of annotations applied directly to this method.
      Specified by:
      getAnnotationDescriptors in interface AnnotatedObject
      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 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

      Collection<AnnotationValue> getAnnotations()
      Get collection of all AnnotationValues applied directly to the method.
      Specified by:
      getAnnotations in interface AnnotatedObject
      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()