LocalVariableListpublic final class LocalVariableList extends com.android.dx.util.FixedSizeList List of "local variable" entries, which are the contents of
{@code LocalVariableTable} and {@code LocalVariableTypeTable}
attributes, as well as combinations of the two. |
Fields Summary |
---|
public static final LocalVariableList | EMPTY{@code non-null;} zero-size instance |
Constructors Summary |
---|
public LocalVariableList(int count)Constructs an instance.
super(count);
|
Methods Summary |
---|
public static com.android.dx.cf.code.LocalVariableList | concat(com.android.dx.cf.code.LocalVariableList list1, com.android.dx.cf.code.LocalVariableList list2)Returns an instance which is the concatenation of the two given
instances. The result is immutable.
if (list1 == EMPTY) {
// easy case
return list2;
}
int sz1 = list1.size();
int sz2 = list2.size();
LocalVariableList result = new LocalVariableList(sz1 + sz2);
for (int i = 0; i < sz1; i++) {
result.set(i, list1.get(i));
}
for (int i = 0; i < sz2; i++) {
result.set(sz1 + i, list2.get(i));
}
result.setImmutable();
return result;
| public com.android.dx.cf.code.LocalVariableList$Item | get(int n)Gets the indicated item.
return (Item) get0(n);
| public com.android.dx.cf.code.LocalVariableList$Item | itemToLocal(com.android.dx.cf.code.LocalVariableList$Item item)Gets the local variable information in this instance which matches
the given {@link com.android.dx.cf.code.LocalVariableList.Item}
in all respects but the type descriptor and signature, if any.
int sz = size();
for (int i = 0; i < sz; i++) {
Item one = (Item) get0(i);
if ((one != null) && one.matchesAllButType(item)) {
return one;
}
}
return null;
| public static com.android.dx.cf.code.LocalVariableList | mergeDescriptorsAndSignatures(com.android.dx.cf.code.LocalVariableList descriptorList, com.android.dx.cf.code.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.
int descriptorSize = descriptorList.size();
LocalVariableList result = new LocalVariableList(descriptorSize);
for (int i = 0; i < descriptorSize; i++) {
Item item = descriptorList.get(i);
Item signatureItem = signatureList.itemToLocal(item);
if (signatureItem != null) {
CstString signature = signatureItem.getSignature();
item = item.withSignature(signature);
}
result.set(i, item);
}
result.setImmutable();
return result;
| public com.android.dx.cf.code.LocalVariableList$Item | pcAndIndexToLocal(int pc, int index)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.
int sz = size();
for (int i = 0; i < sz; i++) {
Item one = (Item) get0(i);
if ((one != null) && one.matchesPcAndIndex(pc, index)) {
return one;
}
}
return null;
| public void | set(int n, com.android.dx.cf.code.LocalVariableList$Item item)Sets the item at the given index.
if (item == null) {
throw new NullPointerException("item == null");
}
set0(n, item);
| public void | set(int n, int startPc, int length, com.android.dx.rop.cst.CstString name, com.android.dx.rop.cst.CstString descriptor, com.android.dx.rop.cst.CstString signature, int index)Sets the item at the given index.
Note: At least one of {@code descriptor} or
{@code signature} must be passed as non-null.
set0(n, new Item(startPc, length, name, descriptor, signature, index));
|
|