Interface MethodHandleReference

All Superinterfaces:
Comparable<MethodHandleReference>, Reference
All Known Implementing Classes:
BaseMethodHandleReference, BuilderMethodHandleReference, DexBackedMethodHandleReference, ImmutableMethodHandleReference

public interface MethodHandleReference extends Reference, Comparable<MethodHandleReference>
This class represents a reference to a method handle
  • Method Details

    • getMethodHandleType

      int getMethodHandleType()
      Gets the method handle type.
      Returns:
      One of the MethodHandleType values
    • getMemberReference

      @Nonnull Reference getMemberReference()
      Gets the member that is being referenced by this method handle.
      Returns:
      A MethodReference or FieldReference, depending on the method handle type
    • hashCode

      int hashCode()
      Returns a hashcode for this MethodHandleReference. This hashCode is defined to be the following:
       
       int hashCode =  getMethodHandleType();
       hashCode = hashCode*31 + getMemberReference().hashCode();
       
      Overrides:
      hashCode in class Object
      Returns:
      The hash code value for this MethodHandleReference
    • equals

      boolean equals(@Nullable Object o)
      Compares this MethodHandleReference to another MethodHandleReference for equality. This MethodHandleReference is equal to another MethodHandleReference if all of its fields are equal. That is, if the return values of getMethodHandleType() and getMemberReference() are all equal.
      Overrides:
      equals in class Object
      Parameters:
      o - The object to be compared for equality with this MethodHandleReference
      Returns:
      true if the specified object is equal to this MethodHandleReference
    • compareTo

      int compareTo(@Nonnull MethodHandleReference o)
      Compare this MethodHandleReference to another MethodHandleReference. The comparison is based on the comparison of the return values of getMethodHandleType() and getMemberReference() in that order.
      Specified by:
      compareTo in interface Comparable<MethodHandleReference>
      Parameters:
      o - The MethodHandleReference to compare with this MethodHandleReference
      Returns:
      An integer representing the result of the comparison