com.android.dx.cf.code
Class LocalVariableList.Item

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

public static class LocalVariableList.Item
extends Object

Item in a local variable table.


Constructor Summary
LocalVariableList.Item(int startPc, int length, CstString name, CstString descriptor, CstString signature, int index)
          Constructs an instance.
 
Method Summary
 CstString getDescriptor()
          Gets the variable's type descriptor.
 int getIndex()
          Gets the variable's local index.
 int getLength()
          Gets the length (in bytecodes) of this variable's scope.
 LocalItem getLocalItem()
          Gets the variable's LocalItem, a (name, signature) tuple
 int getStartPc()
          Gets the start pc of this variable's scope.
 Type getType()
          Gets the variable's type descriptor.
 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.
 boolean matchesPcAndIndex(int pc, int index)
          Gets whether this instance matches (describes) the given address and index.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalVariableList.Item

public LocalVariableList.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 Detail

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


Copyright © 2015. All rights reserved.