Package com.android.dx.cf.code
Class LocalVariableList
java.lang.Object
com.android.dx.util.MutabilityControl
com.android.dx.util.FixedSizeList
com.android.dx.cf.code.LocalVariableList
- All Implemented Interfaces:
ToHuman
List of "local variable" entries, which are the contents of
LocalVariableTable
and LocalVariableTypeTable
attributes, as well as combinations of the two.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Item in a local variable table. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic LocalVariableList
concat
(LocalVariableList list1, LocalVariableList list2) Returns an instance which is the concatenation of the two given instances.get
(int n) Gets the indicated item.Gets the local variable information in this instance which matches the givenLocalVariableList.Item
in all respects but the type descriptor and signature, if any.static LocalVariableList
mergeDescriptorsAndSignatures
(LocalVariableList descriptorList, LocalVariableList signatureList) Returns an instance which is the result of merging the two given instances, where one instance should have only type descriptors and the other only type signatures.pcAndIndexToLocal
(int pc, int index) Gets the local variable information associated with a given address and local index, if any.void
set
(int n, int startPc, int length, CstString name, CstString descriptor, CstString signature, int index) Sets the item at the given index.void
set
(int n, LocalVariableList.Item item) Sets the item at the given index.Methods inherited from class com.android.dx.util.FixedSizeList
equals, get0, getOrNull0, hashCode, set0, shrinkToFit, size, toHuman, toHuman, toString, toString
Methods inherited from class com.android.dx.util.MutabilityControl
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutable
-
Field Details
-
EMPTY
non-null;
zero-size instance
-
-
Constructor Details
-
LocalVariableList
public LocalVariableList(int count) Constructs an instance.- Parameters:
count
- the number of elements to be in the list
-
-
Method Details
-
concat
Returns an instance which is the concatenation of the two given instances. The result is immutable.- Parameters:
list1
-non-null;
first instancelist2
-non-null;
second instance- Returns:
non-null;
combined instance
-
mergeDescriptorsAndSignatures
public static LocalVariableList mergeDescriptorsAndSignatures(LocalVariableList descriptorList, LocalVariableList signatureList) Returns an instance which is the result of merging the two given instances, where one instance should have only type descriptors and the other only type signatures. The merged result is identical to the one with descriptors, except that any element whose {name, index, start, length} matches an element in the signature list gets augmented with the corresponding signature. The result is immutable.- Parameters:
descriptorList
-non-null;
list with descriptorssignatureList
-non-null;
list with signatures- Returns:
non-null;
the merged result
-
get
Gets the indicated item.- Parameters:
n
->= 0;
which item- Returns:
null-ok;
the indicated item
-
set
Sets the item at the given index.- Parameters:
n
->= 0, < size();
which elementitem
-non-null;
the item
-
set
public void set(int n, int startPc, int length, CstString name, CstString descriptor, CstString signature, int index) Sets the item at the given index.Note: At least one of
descriptor
orsignature
must be passed as non-null.- Parameters:
n
->= 0, < size();
which elementstartPc
->= 0;
the start pc of this variable's scopelength
->= 0;
the length (in bytecodes) of this variable's scopename
-non-null;
the variable's namedescriptor
-null-ok;
the variable's type descriptorsignature
-null-ok;
the variable's type signatureindex
->= 0;
the variable's local index
-
itemToLocal
Gets the local variable information in this instance which matches the givenLocalVariableList.Item
in all respects but the type descriptor and signature, if any.- Parameters:
item
-non-null;
local variable information to match- Returns:
null-ok;
the corresponding local variable information stored in this instance, ornull
if there is no matching information
-
pcAndIndexToLocal
Gets the local variable information associated with a given address and local index, if any. Note: In standard classfiles, a variable's start point is listed as the address of the instruction just past the one that sets the variable.- Parameters:
pc
->= 0;
the address to look upindex
->= 0;
the local variable index- Returns:
null-ok;
the associated local variable information, ornull
if none is known
-