Class EncodedMethod

java.lang.Object
com.android.dx.dex.file.EncodedMember
com.android.dx.dex.file.EncodedMethod
All Implemented Interfaces:
ToHuman, Comparable<EncodedMethod>

public final class EncodedMethod extends EncodedMember implements Comparable<EncodedMethod>
Class that representats a method of a class.
  • Constructor Details

    • EncodedMethod

      public EncodedMethod(CstMethodRef method, int accessFlags, DalvCode code, TypeList throwsList)
      Constructs an instance.
      Parameters:
      method - non-null; constant for the method
      accessFlags - access flags
      code - null-ok; code for the method, if it is neither abstract nor native
      throwsList - non-null; list of possibly-thrown exceptions, just used in generating debugging output (listings)
  • Method Details

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(EncodedMethod other)

      Note: This compares the method constants only, ignoring any associated code, because it should never be the case that two different items with the same method constant ever appear in the same list (or same file, even).

      Specified by:
      compareTo in interface Comparable<EncodedMethod>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addContents

      public void addContents(DexFile file)
      Populates a DexFile with items from within this instance.
      Specified by:
      addContents in class EncodedMember
      Parameters:
      file - non-null; the file to populate
    • toHuman

      public final String toHuman()
      Return the "human" string form of this instance. This is generally less "debuggy" than toString().
      Specified by:
      toHuman in interface ToHuman
      Returns:
      non-null; the human string form
    • getName

      public final CstString getName()
      Gets the name.
      Specified by:
      getName in class EncodedMember
      Returns:
      non-null; the name
    • debugPrint

      public void debugPrint(PrintWriter out, boolean verbose)
      Does a human-friendly dump of this instance.
      Specified by:
      debugPrint in class EncodedMember
      Parameters:
      out - non-null; where to dump
      verbose - whether to be verbose with the output
    • getRef

      public final CstMethodRef getRef()
      Gets the constant for the method.
      Returns:
      non-null; the constant
    • encode

      public int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq)
      Encodes this instance to the given output.
      Specified by:
      encode in class EncodedMember
      Parameters:
      file - non-null; file this instance is part of
      out - non-null; where to write to
      lastIndex - >= 0; the previous member index value encoded, or 0 if this is the first element to encode
      dumpSeq - >= 0; sequence number of this instance for annotation purposes
      Returns:
      >= 0; the member index value that was encoded