com.android.dx.cf.code.LocalVariableList Java Examples
The following examples show how to use
com.android.dx.cf.code.LocalVariableList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseLocalVariables.java From Box with Apache License 2.0 | 6 votes |
/** * 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; }
Example #2
Source File: StdAttributeFactory.java From buck with Apache License 2.0 | 6 votes |
/** * Parses a {@code LocalVariableTypeTable} attribute. */ private Attribute localVariableTypeTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { if (length < 2) { return throwSeverelyTruncated(); } ByteArray bytes = cf.getBytes(); int count = bytes.getUnsignedShort(offset); if (observer != null) { observer.parsed(bytes, offset, 2, "local_variable_type_table_length: " + Hex.u2(count)); } LocalVariableList list = parseLocalVariables( bytes.slice(offset + 2, offset + length), cf.getConstantPool(), observer, count, true); return new AttLocalVariableTypeTable(list); }
Example #3
Source File: StdAttributeFactory.java From buck with Apache License 2.0 | 6 votes |
/** * Parses a {@code LocalVariableTable} attribute. */ private Attribute localVariableTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { if (length < 2) { return throwSeverelyTruncated(); } ByteArray bytes = cf.getBytes(); int count = bytes.getUnsignedShort(offset); if (observer != null) { observer.parsed(bytes, offset, 2, "local_variable_table_length: " + Hex.u2(count)); } LocalVariableList list = parseLocalVariables( bytes.slice(offset + 2, offset + length), cf.getConstantPool(), observer, count, false); return new AttLocalVariableTable(list); }
Example #4
Source File: StdAttributeFactory.java From Box with Apache License 2.0 | 6 votes |
/** * Parses a {@code LocalVariableTable} attribute. */ private Attribute localVariableTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { if (length < 2) { return throwSeverelyTruncated(); } ByteArray bytes = cf.getBytes(); int count = bytes.getUnsignedShort(offset); if (observer != null) { observer.parsed(bytes, offset, 2, "local_variable_table_length: " + Hex.u2(count)); } LocalVariableList list = parseLocalVariables( bytes.slice(offset + 2, offset + length), cf.getConstantPool(), observer, count, false); return new AttLocalVariableTable(list); }
Example #5
Source File: StdAttributeFactory.java From Box with Apache License 2.0 | 6 votes |
/** * Parses a {@code LocalVariableTypeTable} attribute. */ private Attribute localVariableTypeTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { if (length < 2) { return throwSeverelyTruncated(); } ByteArray bytes = cf.getBytes(); int count = bytes.getUnsignedShort(offset); if (observer != null) { observer.parsed(bytes, offset, 2, "local_variable_type_table_length: " + Hex.u2(count)); } LocalVariableList list = parseLocalVariables( bytes.slice(offset + 2, offset + length), cf.getConstantPool(), observer, count, true); return new AttLocalVariableTypeTable(list); }
Example #6
Source File: BaseLocalVariables.java From buck with Apache License 2.0 | 6 votes |
/** * 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; }
Example #7
Source File: BaseLocalVariables.java From Box with Apache License 2.0 | 6 votes |
/** * 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; }
Example #8
Source File: StdAttributeFactory.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** * Parses a {@code LocalVariableTypeTable} attribute. */ private Attribute localVariableTypeTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { if (length < 2) { return throwSeverelyTruncated(); } ByteArray bytes = cf.getBytes(); int count = bytes.getUnsignedShort(offset); if (observer != null) { observer.parsed(bytes, offset, 2, "local_variable_type_table_length: " + Hex.u2(count)); } LocalVariableList list = parseLocalVariables( bytes.slice(offset + 2, offset + length), cf.getConstantPool(), observer, count, true); return new AttLocalVariableTypeTable(list); }
Example #9
Source File: StdAttributeFactory.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** * Parses a {@code LocalVariableTable} attribute. */ private Attribute localVariableTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { if (length < 2) { return throwSeverelyTruncated(); } ByteArray bytes = cf.getBytes(); int count = bytes.getUnsignedShort(offset); if (observer != null) { observer.parsed(bytes, offset, 2, "local_variable_table_length: " + Hex.u2(count)); } LocalVariableList list = parseLocalVariables( bytes.slice(offset + 2, offset + length), cf.getConstantPool(), observer, count, false); return new AttLocalVariableTable(list); }
Example #10
Source File: StdAttributeFactory.java From Box with Apache License 2.0 | 6 votes |
/** * Parses a {@code LocalVariableTable} attribute. */ private Attribute localVariableTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { if (length < 2) { return throwSeverelyTruncated(); } ByteArray bytes = cf.getBytes(); int count = bytes.getUnsignedShort(offset); if (observer != null) { observer.parsed(bytes, offset, 2, "local_variable_table_length: " + Hex.u2(count)); } LocalVariableList list = parseLocalVariables( bytes.slice(offset + 2, offset + length), cf.getConstantPool(), observer, count, false); return new AttLocalVariableTable(list); }
Example #11
Source File: StdAttributeFactory.java From Box with Apache License 2.0 | 6 votes |
/** * Parses a {@code LocalVariableTypeTable} attribute. */ private Attribute localVariableTypeTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { if (length < 2) { return throwSeverelyTruncated(); } ByteArray bytes = cf.getBytes(); int count = bytes.getUnsignedShort(offset); if (observer != null) { observer.parsed(bytes, offset, 2, "local_variable_type_table_length: " + Hex.u2(count)); } LocalVariableList list = parseLocalVariables( bytes.slice(offset + 2, offset + length), cf.getConstantPool(), observer, count, true); return new AttLocalVariableTypeTable(list); }
Example #12
Source File: BaseLocalVariables.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** * 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; }
Example #13
Source File: StdAttributeFactory.java From buck with Apache License 2.0 | 4 votes |
/** * Parse the table part of either a {@code LocalVariableTable} * or a {@code LocalVariableTypeTable}. * * @param bytes {@code non-null;} bytes to parse, which should <i>only</i> * contain the table data (no header) * @param pool {@code non-null;} constant pool to use * @param count {@code >= 0;} the number of entries * @param typeTable {@code true} iff this is for a type table * @return {@code non-null;} the constructed list */ private LocalVariableList parseLocalVariables(ByteArray bytes, ConstantPool pool, ParseObserver observer, int count, boolean typeTable) { if (bytes.size() != (count * 10)) { // "+ 2" is for the count. throwBadLength((count * 10) + 2); } ByteArray.MyDataInputStream in = bytes.makeDataInputStream(); LocalVariableList list = new LocalVariableList(count); try { for (int i = 0; i < count; i++) { int startPc = in.readUnsignedShort(); int length = in.readUnsignedShort(); int nameIdx = in.readUnsignedShort(); int typeIdx = in.readUnsignedShort(); int index = in.readUnsignedShort(); CstString name = (CstString) pool.get(nameIdx); CstString type = (CstString) pool.get(typeIdx); CstString descriptor = null; CstString signature = null; if (typeTable) { signature = type; } else { descriptor = type; } list.set(i, startPc, length, name, descriptor, signature, index); if (observer != null) { observer.parsed(bytes, i * 10, 10, Hex.u2(startPc) + ".." + Hex.u2(startPc + length) + " " + Hex.u2(index) + " " + name.toHuman() + " " + type.toHuman()); } } } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } list.setImmutable(); return list; }
Example #14
Source File: StdAttributeFactory.java From J2ME-Loader with Apache License 2.0 | 4 votes |
/** * Parse the table part of either a {@code LocalVariableTable} * or a {@code LocalVariableTypeTable}. * * @param bytes {@code non-null;} bytes to parse, which should <i>only</i> * contain the table data (no header) * @param pool {@code non-null;} constant pool to use * @param count {@code >= 0;} the number of entries * @param typeTable {@code true} iff this is for a type table * @return {@code non-null;} the constructed list */ private LocalVariableList parseLocalVariables(ByteArray bytes, ConstantPool pool, ParseObserver observer, int count, boolean typeTable) { if (bytes.size() != (count * 10)) { // "+ 2" is for the count. throwBadLength((count * 10) + 2); } ByteArray.MyDataInputStream in = bytes.makeDataInputStream(); LocalVariableList list = new LocalVariableList(count); try { for (int i = 0; i < count; i++) { int startPc = in.readUnsignedShort(); int length = in.readUnsignedShort(); int nameIdx = in.readUnsignedShort(); int typeIdx = in.readUnsignedShort(); int index = in.readUnsignedShort(); CstString name = (CstString) pool.get(nameIdx); CstString type = (CstString) pool.get(typeIdx); CstString descriptor = null; CstString signature = null; if (typeTable) { signature = type; } else { descriptor = type; } list.set(i, startPc, length, name, descriptor, signature, index); if (observer != null) { observer.parsed(bytes, i * 10, 10, Hex.u2(startPc) + ".." + Hex.u2(startPc + length) + " " + Hex.u2(index) + " " + name.toHuman() + " " + type.toHuman()); } } } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } list.setImmutable(); return list; }
Example #15
Source File: StdAttributeFactory.java From Box with Apache License 2.0 | 4 votes |
/** * Parse the table part of either a {@code LocalVariableTable} * or a {@code LocalVariableTypeTable}. * * @param bytes {@code non-null;} bytes to parse, which should <i>only</i> * contain the table data (no header) * @param pool {@code non-null;} constant pool to use * @param count {@code >= 0;} the number of entries * @param typeTable {@code true} iff this is for a type table * @return {@code non-null;} the constructed list */ private LocalVariableList parseLocalVariables(ByteArray bytes, ConstantPool pool, ParseObserver observer, int count, boolean typeTable) { if (bytes.size() != (count * 10)) { // "+ 2" is for the count. throwBadLength((count * 10) + 2); } ByteArray.MyDataInputStream in = bytes.makeDataInputStream(); LocalVariableList list = new LocalVariableList(count); try { for (int i = 0; i < count; i++) { int startPc = in.readUnsignedShort(); int length = in.readUnsignedShort(); int nameIdx = in.readUnsignedShort(); int typeIdx = in.readUnsignedShort(); int index = in.readUnsignedShort(); CstString name = (CstString) pool.get(nameIdx); CstString type = (CstString) pool.get(typeIdx); CstString descriptor = null; CstString signature = null; if (typeTable) { signature = type; } else { descriptor = type; } list.set(i, startPc, length, name, descriptor, signature, index); if (observer != null) { observer.parsed(bytes, i * 10, 10, Hex.u2(startPc) + ".." + Hex.u2(startPc + length) + " " + Hex.u2(index) + " " + name.toHuman() + " " + type.toHuman()); } } } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } list.setImmutable(); return list; }
Example #16
Source File: StdAttributeFactory.java From Box with Apache License 2.0 | 4 votes |
/** * Parse the table part of either a {@code LocalVariableTable} * or a {@code LocalVariableTypeTable}. * * @param bytes {@code non-null;} bytes to parse, which should <i>only</i> * contain the table data (no header) * @param pool {@code non-null;} constant pool to use * @param count {@code >= 0;} the number of entries * @param typeTable {@code true} iff this is for a type table * @return {@code non-null;} the constructed list */ private LocalVariableList parseLocalVariables(ByteArray bytes, ConstantPool pool, ParseObserver observer, int count, boolean typeTable) { if (bytes.size() != (count * 10)) { // "+ 2" is for the count. throwBadLength((count * 10) + 2); } ByteArray.MyDataInputStream in = bytes.makeDataInputStream(); LocalVariableList list = new LocalVariableList(count); try { for (int i = 0; i < count; i++) { int startPc = in.readUnsignedShort(); int length = in.readUnsignedShort(); int nameIdx = in.readUnsignedShort(); int typeIdx = in.readUnsignedShort(); int index = in.readUnsignedShort(); CstString name = (CstString) pool.get(nameIdx); CstString type = (CstString) pool.get(typeIdx); CstString descriptor = null; CstString signature = null; if (typeTable) { signature = type; } else { descriptor = type; } list.set(i, startPc, length, name, descriptor, signature, index); if (observer != null) { observer.parsed(bytes, i * 10, 10, Hex.u2(startPc) + ".." + Hex.u2(startPc + length) + " " + Hex.u2(index) + " " + name.toHuman() + " " + type.toHuman()); } } } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } list.setImmutable(); return list; }
Example #17
Source File: AttLocalVariableTypeTable.java From J2ME-Loader with Apache License 2.0 | 2 votes |
/** * Constructs an instance. * * @param localVariables {@code non-null;} list of local variable entries */ public AttLocalVariableTypeTable(LocalVariableList localVariables) { super(ATTRIBUTE_NAME, localVariables); }
Example #18
Source File: BaseLocalVariables.java From J2ME-Loader with Apache License 2.0 | 2 votes |
/** * Gets the list of "local variable" entries associated with this instance. * * @return {@code non-null;} the list */ public final LocalVariableList getLocalVariables() { return localVariables; }
Example #19
Source File: AttLocalVariableTable.java From J2ME-Loader with Apache License 2.0 | 2 votes |
/** * Constructs an instance. * * @param localVariables {@code non-null;} list of local variable entries */ public AttLocalVariableTable(LocalVariableList localVariables) { super(ATTRIBUTE_NAME, localVariables); }
Example #20
Source File: AttLocalVariableTable.java From Box with Apache License 2.0 | 2 votes |
/** * Constructs an instance. * * @param localVariables {@code non-null;} list of local variable entries */ public AttLocalVariableTable(LocalVariableList localVariables) { super(ATTRIBUTE_NAME, localVariables); }
Example #21
Source File: BaseLocalVariables.java From Box with Apache License 2.0 | 2 votes |
/** * Gets the list of "local variable" entries associated with this instance. * * @return {@code non-null;} the list */ public final LocalVariableList getLocalVariables() { return localVariables; }
Example #22
Source File: AttLocalVariableTypeTable.java From Box with Apache License 2.0 | 2 votes |
/** * Constructs an instance. * * @param localVariables {@code non-null;} list of local variable entries */ public AttLocalVariableTypeTable(LocalVariableList localVariables) { super(ATTRIBUTE_NAME, localVariables); }
Example #23
Source File: AttLocalVariableTypeTable.java From buck with Apache License 2.0 | 2 votes |
/** * Constructs an instance. * * @param localVariables {@code non-null;} list of local variable entries */ public AttLocalVariableTypeTable(LocalVariableList localVariables) { super(ATTRIBUTE_NAME, localVariables); }
Example #24
Source File: BaseLocalVariables.java From buck with Apache License 2.0 | 2 votes |
/** * Gets the list of "local variable" entries associated with this instance. * * @return {@code non-null;} the list */ public final LocalVariableList getLocalVariables() { return localVariables; }
Example #25
Source File: AttLocalVariableTable.java From buck with Apache License 2.0 | 2 votes |
/** * Constructs an instance. * * @param localVariables {@code non-null;} list of local variable entries */ public AttLocalVariableTable(LocalVariableList localVariables) { super(ATTRIBUTE_NAME, localVariables); }
Example #26
Source File: AttLocalVariableTable.java From Box with Apache License 2.0 | 2 votes |
/** * Constructs an instance. * * @param localVariables {@code non-null;} list of local variable entries */ public AttLocalVariableTable(LocalVariableList localVariables) { super(ATTRIBUTE_NAME, localVariables); }
Example #27
Source File: BaseLocalVariables.java From Box with Apache License 2.0 | 2 votes |
/** * Gets the list of "local variable" entries associated with this instance. * * @return {@code non-null;} the list */ public final LocalVariableList getLocalVariables() { return localVariables; }
Example #28
Source File: AttLocalVariableTypeTable.java From Box with Apache License 2.0 | 2 votes |
/** * Constructs an instance. * * @param localVariables {@code non-null;} list of local variable entries */ public AttLocalVariableTypeTable(LocalVariableList localVariables) { super(ATTRIBUTE_NAME, localVariables); }