Class LocalVariableList.Item

java.lang.Object
com.android.dx.cf.code.LocalVariableList.Item
Enclosing class:
LocalVariableList

public static class LocalVariableList.Item extends Object
Item in a local variable table.
  • Constructor Details

    • Item

      public Item(int startPc, int length, CstString name, CstString descriptor, CstString signature, int index)
      Constructs an instance.

      Note: At least one of descriptor or signature must be passed as non-null.

      Parameters:
      startPc - >= 0; the start pc of this variable's scope
      length - >= 0; the length (in bytecodes) of this variable's scope
      name - non-null; the variable's name
      descriptor - null-ok; the variable's type descriptor
      signature - null-ok; the variable's type signature
      index - >= 0; the variable's local index
  • Method Details

    • getStartPc

      public int getStartPc()
      Gets the start pc of this variable's scope.
      Returns:
      >= 0; the start pc of this variable's scope
    • getLength

      public int getLength()
      Gets the length (in bytecodes) of this variable's scope.
      Returns:
      >= 0; the length (in bytecodes) of this variable's scope
    • getDescriptor

      public CstString getDescriptor()
      Gets the variable's type descriptor.
      Returns:
      null-ok; the variable's type descriptor
    • getLocalItem

      public LocalItem getLocalItem()
      Gets the variable's LocalItem, a (name, signature) tuple
      Returns:
      null-ok; the variable's type descriptor
    • getIndex

      public int getIndex()
      Gets the variable's local index.
      Returns:
      >= 0; the variable's local index
    • getType

      public Type getType()
      Gets the variable's type descriptor. This is a convenient shorthand for Type.intern(getDescriptor().getString()).
      Returns:
      non-null; the variable's type
    • withSignature

      public LocalVariableList.Item withSignature(CstString newSignature)
      Constructs and returns an instance which is identical to this one, except that the signature is changed to the given value.
      Parameters:
      newSignature - non-null; the new signature
      Returns:
      non-null; an appropriately-constructed instance
    • matchesPcAndIndex

      public boolean matchesPcAndIndex(int pc, int index)
      Gets whether this instance matches (describes) the given address and index.
      Parameters:
      pc - >= 0; the address in question
      index - >= 0; the local variable index in question
      Returns:
      true iff this instance matches pc and index
    • matchesAllButType

      public boolean matchesAllButType(LocalVariableList.Item other)
      Gets whether this instance matches (describes) the given other instance exactly in all fields except type descriptor and type signature.
      Parameters:
      other - non-null; the instance to compare to
      Returns:
      true iff this instance matches