/** * Returns an instance which is the concatenation of the two given * instances. The result is immutable. * * @param list1 {@code non-null;} first instance * @param list2 {@code non-null;} second instance * @return {@code non-null;} combined instance */ public static LocalVariableList concat(LocalVariableList list1, LocalVariableList list2) { 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; }
/** * 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. * * @param item {@code non-null;} local variable information to match * @return {@code null-ok;} the corresponding local variable information stored * in this instance, or {@code null} if there is no matching * information */ public Item itemToLocal(Item item) { 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; }
/** * Sets the item at the given index. * * @param n {@code >= 0, < size();} which element * @param item {@code non-null;} the item */ public void set(int n, Item item) { if (item == null) { throw new NullPointerException("item == null"); } set0(n, item); }
LocalVariableList list = new LocalVariableList(count); list.set(i, startPc, length, name, descriptor, signature, index); list.setImmutable(); return list;
lvt = (AttLocalVariableTable) codeAttribs.findNext(lvt)) { localVariables = LocalVariableList.concat(localVariables, lvt.getLocalVariables()); (AttLocalVariableTypeTable) codeAttribs.findNext(lvtt)) { typeList = LocalVariableList.concat(typeList, lvtt.getLocalVariables()); if (typeList.size() != 0) { localVariables = LocalVariableList.mergeDescriptorsAndSignatures( localVariables, typeList);
(opcode == ByteOps.ISTORE) ? (offset + length) : offset; LocalVariableList.Item local = localVariables.pcAndIndexToLocal(localOffset, idx); Type localType;
/** * Gets the indicated item. * * @param n {@code >= 0;} which item * @return {@code null-ok;} the indicated item */ public Item get(int n) { return (Item) get0(n); }
/** * Constructs an instance. * * @param name {@code non-null;} attribute name * @param localVariables {@code non-null;} list of local variable entries */ public BaseLocalVariables(String name, LocalVariableList localVariables) { super(name); try { if (localVariables.isMutable()) { throw new MutabilityException("localVariables.isMutable()"); } } catch (NullPointerException ex) { // Translate the exception. throw new NullPointerException("localVariables == null"); } this.localVariables = localVariables; }
LocalVariableList list = new LocalVariableList(count); list.set(i, startPc, length, name, descriptor, signature, index); list.setImmutable(); return list;
lvt = (AttLocalVariableTable) codeAttribs.findNext(lvt)) { localVariables = LocalVariableList.concat(localVariables, lvt.getLocalVariables()); (AttLocalVariableTypeTable) codeAttribs.findNext(lvtt)) { typeList = LocalVariableList.concat(typeList, lvtt.getLocalVariables()); if (typeList.size() != 0) { localVariables = LocalVariableList.mergeDescriptorsAndSignatures( localVariables, typeList);
(opcode == ByteOps.ISTORE) ? (offset + length) : offset; LocalVariableList.Item local = localVariables.pcAndIndexToLocal(localOffset, idx); Type localType;
/** * Gets the indicated item. * * @param n {@code >= 0;} which item * @return {@code null-ok;} the indicated item */ public Item get(int n) { return (Item) get0(n); }
/** * Constructs an instance. * * @param name {@code non-null;} attribute name * @param localVariables {@code non-null;} list of local variable entries */ public BaseLocalVariables(String name, LocalVariableList localVariables) { super(name); try { if (localVariables.isMutable()) { throw new MutabilityException("localVariables.isMutable()"); } } catch (NullPointerException ex) { // Translate the exception. throw new NullPointerException("localVariables == null"); } this.localVariables = localVariables; }
/** * Returns an instance which is the concatenation of the two given * instances. The result is immutable. * * @param list1 {@code non-null;} first instance * @param list2 {@code non-null;} second instance * @return {@code non-null;} combined instance */ public static LocalVariableList concat(LocalVariableList list1, LocalVariableList list2) { 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; }
LocalVariableList list = new LocalVariableList(count); list.set(i, startPc, length, name, descriptor, signature, index); list.setImmutable(); return list;
lvt = (AttLocalVariableTable) codeAttribs.findNext(lvt)) { localVariables = LocalVariableList.concat(localVariables, lvt.getLocalVariables()); (AttLocalVariableTypeTable) codeAttribs.findNext(lvtt)) { typeList = LocalVariableList.concat(typeList, lvtt.getLocalVariables()); if (typeList.size() != 0) { localVariables = LocalVariableList.mergeDescriptorsAndSignatures( localVariables, typeList);
/** * 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. * * @param item {@code non-null;} local variable information to match * @return {@code null-ok;} the corresponding local variable information stored * in this instance, or {@code null} if there is no matching * information */ public Item itemToLocal(Item item) { 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; }
/** * Sets the item at the given index. * * @param n {@code >= 0, < size();} which element * @param item {@code non-null;} the item */ public void set(int n, Item item) { if (item == null) { throw new NullPointerException("item == null"); } set0(n, item); }
(opcode == ByteOps.ISTORE) ? (offset + length) : offset; LocalVariableList.Item local = localVariables.pcAndIndexToLocal(localOffset, idx); Type localType;
/** * Gets the indicated item. * * @param n {@code >= 0;} which item * @return {@code null-ok;} the indicated item */ public Item get(int n) { return (Item) get0(n); }