Class MethodInfo

All Implemented Interfaces:
AccessibleEntity, ClassMember, ComparableMethod, XMethod, AnnotatedObject, FieldOrMethodName, Serializable, Comparable<ComparableMethod>

public class MethodInfo extends MethodDescriptor implements XMethod
Author:
pugh
See Also:
  • Field Details

    • EMPTY_ARRAY

      public static final MethodInfo[] EMPTY_ARRAY
  • Method Details

    • newArray

      public static MethodInfo[] newArray(int sz)
    • getInvokeDynamicMethods

      public static IdentityHashMap<MethodInfo,Void> getInvokeDynamicMethods()
    • getThrownExceptions

      @CheckForNull public 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?
    • isIdentity

      public boolean isIdentity()
      Description copied from interface: XMethod
      Is this an identity method
      Specified by:
      isIdentity in interface XMethod
    • usesInvokeDynamic

      public boolean usesInvokeDynamic()
      Specified by:
      usesInvokeDynamic in interface XMethod
    • 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
    • isVariableSynthetic

      public boolean isVariableSynthetic(int param)
      Description copied from interface: XMethod
      Is the variable synthetic?
      Specified by:
      isVariableSynthetic in interface XMethod
    • getMethodCallCount

      public int getMethodCallCount()
    • 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
    • isBridge

      public boolean isBridge()
      Description copied from interface: XMethod
      Is this a bridge method?
      Specified by:
      isBridge 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 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 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 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(ComparableMethod rhs)
      Specified by:
      compareTo in interface Comparable<ComparableMethod>
      Overrides:
      compareTo in class MethodDescriptor
    • 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 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
    • hasParameterAnnotations

      public boolean hasParameterAnnotations()
      Specified by:
      hasParameterAnnotations in interface XMethod
    • 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 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 Collection<ClassDescriptor> getAnnotationDescriptors()
      Description copied from interface: XMethod
      Get ClassDescriptors (annotation classes) of annotations applied directly to this method.
      Specified by:
      getAnnotationDescriptors in interface AnnotatedObject
      Specified by:
      getAnnotationDescriptors in interface XMethod
      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 AnnotatedObject
      Specified by:
      getAnnotation in interface XMethod
      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 Collection<AnnotationValue> getAnnotations()
      Description copied from interface: XMethod
      Get collection of all AnnotationValues applied directly to the method.
      Specified by:
      getAnnotations in interface AnnotatedObject
      Specified by:
      getAnnotations in interface XMethod
      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.)
      Specified by:
      addAnnotation in interface XMethod
      Parameters:
      annotationValue - an AnnotationValue representing a method annotation
    • addParameterAnnotation

      public void addParameterAnnotation(int param, AnnotationValue annotationValue)
      Destructively add a parameter annotation.
      Specified by:
      addParameterAnnotation in interface XMethod
      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 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?
    • hasBackBranch

      public boolean hasBackBranch()
    • isStub

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

      @CheckForNull public MethodDescriptor getAccessMethodForMethod()
      Specified by:
      getAccessMethodForMethod in interface XMethod
    • getAccessMethodForField

      @CheckForNull public FieldDescriptor getAccessMethodForField()
      Specified by:
      getAccessMethodForField in interface XMethod
    • bridgeFrom

      public XMethod bridgeFrom()
      Specified by:
      bridgeFrom in interface XMethod
    • bridgeTo

      public XMethod bridgeTo()
      Description copied from interface: XMethod
      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.
      Specified by:
      bridgeTo in interface XMethod
    • resolveAccessMethodForMethod

      public XMethod resolveAccessMethodForMethod()
      Specified by:
      resolveAccessMethodForMethod in interface XMethod