Modifier and Type | Class and Description |
---|---|
pack-priv static class | Attribute.Set
A set of attribute prototypes (attributes with the same type are considered equal). |
Modifier and Type | Field and Description |
---|---|
private byte[] | content
The raw content of this attribute, only used for unknown attributes (see |
pack-priv Attribute | nextAttribute
The next attribute in this attribute list (Attribute instances can be linked via this field to store a list of class, field, method or Code attributes). |
public final String | type
The type of this attribute, also called its name in the JVMS. |
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
pack-priv final int | Returns: the size of all the attributes in this attribute list. This size includes the size of the attribute headers.where the constants used in the attributes must be stored. symbolTable)Returns the total size in bytes of all the attributes in the attribute list that begins with this attribute. |
pack-priv final int | Returns: the size of all the attributes in this attribute list. This size includes the size of the attribute headers.where the constants used in the attributes must be stored. symbolTable, final byte[] the bytecode of the method corresponding to these Code attributes, or null if they are not Code attributes. Corresponds to the 'code' field of the Code
attribute. code, final int the length of the bytecode of the method corresponding to these code
attributes, or 0 if they are not Code attributes. Corresponds to the 'code_length' field of
the Code attribute. codeLength, final int the maximum stack size of the method corresponding to these Code attributes, or
-1 if they are not Code attributes. maxStack, final int the maximum number of local variables of the method corresponding to these
Code attributes, or -1 if they are not Code attribute. maxLocals)Returns the total size in bytes of all the attributes in the attribute list that begins with this attribute. |
pack-priv static int | Returns: the size of all the attributes in bytes. This size includes the size of the attribute headers.where the constants used in the attributes must be stored. symbolTable, final int some field, method or class access flags. accessFlags, final int the constant pool index of a field, method of class signature. signatureIndex)Returns the total size in bytes of all the attributes that correspond to the given field, method or class access flags and signature. |
pack-priv final int | Returns: the number of attributes of the attribute list that begins with this attribute.Returns the number of attributes of the attribute list that begins with this attribute. |
protected Label[] | Returns: the labels corresponding to this attribute, or null if this attribute is not a Code attribute that contains labels.Returns the labels corresponding to this attribute. |
public boolean | Returns: true if this type of attribute is a Code attribute.Returns true if this type of attribute is a Code attribute. |
public boolean | Returns: true if this type of attribute is unknown.Returns true if this type of attribute is unknown. |
pack-priv final void | putAttributes(final SymbolTable
where the constants used in the attributes must be stored. symbolTable, final ByteVector where the attributes must be written. output)Puts all the attributes of the attribute list that begins with this attribute, in the given byte vector. |
pack-priv final void | putAttributes(final SymbolTable
where the constants used in the attributes must be stored. symbolTable, final byte[] the bytecode of the method corresponding to these Code attributes, or null if they are not Code attributes. Corresponds to the 'code' field of the Code
attribute. code, final int the length of the bytecode of the method corresponding to these code
attributes, or 0 if they are not Code attributes. Corresponds to the 'code_length' field of
the Code attribute. codeLength, final int the maximum stack size of the method corresponding to these Code attributes, or
-1 if they are not Code attributes. maxStack, final int the maximum number of local variables of the method corresponding to these
Code attributes, or -1 if they are not Code attribute. maxLocals, final ByteVector where the attributes must be written. output)Puts all the attributes of the attribute list that begins with this attribute, in the given byte vector. |
pack-priv static void | putAttributes(final SymbolTable
where the constants used in the attributes must be stored. symbolTable, final int some field, method or class access flags. accessFlags, final int the constant pool index of a field, method of class signature. signatureIndex, final ByteVector where the attributes must be written. output)Puts all the attributes that correspond to the given field, method or class access flags and signature, in the given byte vector. |
protected Attribute | Returns: a newAttribute object corresponding to the specified bytes.the class that contains the attribute to be read. classReader, final int index of the first byte of the attribute's content in offset, final int ClassReader . The 6
attribute header bytes (attribute_name_index and attribute_length) are not taken into
account here.the length of the attribute's content (excluding the 6 attribute header bytes). length, final char[] the buffer to be used to call the ClassReader methods requiring a
'charBuffer' parameter. charBuffer, final int index of the first byte of content of the enclosing Code attribute
in codeAttributeOffset, final Label[] ClassReader , or -1 if the attribute to be read is not a Code attribute. The 6
attribute header bytes (attribute_name_index and attribute_length) are not taken into
account here.the labels of the method's code, or null if the attribute to be read
is not a Code attribute. labels)Reads a |
protected ByteVector | Returns: the byte array form of this attribute.the class to which this attribute must be added. This parameter can be used
to add the items that corresponds to this attribute to the constant pool of this class. classWriter, final byte[] the bytecode of the method corresponding to this Code attribute, or null
if this attribute is not a Code attribute. Corresponds to the 'code' field of the Code
attribute. code, final int the length of the bytecode of the method corresponding to this code
attribute, or 0 if this attribute is not a Code attribute. Corresponds to the 'code_length'
field of the Code attribute. codeLength, final int the maximum stack size of the method corresponding to this Code attribute, or
-1 if this attribute is not a Code attribute. maxStack, final int the maximum number of local variables of the method corresponding to this code
attribute, or -1 if this attribute is not a Code attribute. maxLocals)Returns the byte array form of the content of this attribute. |
content | back to summary |
---|---|
private byte[] content The raw content of this attribute, only used for unknown attributes (see |
nextAttribute | back to summary |
---|---|
pack-priv Attribute nextAttribute The next attribute in this attribute list (Attribute instances can be linked via this field to store a list of class, field, method or Code attributes). May be null. |
type | back to summary |
---|---|
public final String type The type of this attribute, also called its name in the JVMS. |
Attribute | back to summary |
---|---|
protected Attribute(final String type) Constructs a new empty attribute.
|
computeAttributesSize | back to summary |
---|---|
pack-priv final int computeAttributesSize(final SymbolTable symbolTable) Returns the total size in bytes of all the attributes in the attribute list that begins with this attribute. This size includes the 6 header bytes (attribute_name_index and attribute_length) per attribute. Also adds the attribute type names to the constant pool.
|
computeAttributesSize | back to summary |
---|---|
pack-priv final int computeAttributesSize(final SymbolTable symbolTable, final byte[] code, final int codeLength, final int maxStack, final int maxLocals) Returns the total size in bytes of all the attributes in the attribute list that begins with this attribute. This size includes the 6 header bytes (attribute_name_index and attribute_length) per attribute. Also adds the attribute type names to the constant pool.
|
computeAttributesSize | back to summary |
---|---|
pack-priv static int computeAttributesSize(final SymbolTable symbolTable, final int accessFlags, final int signatureIndex) Returns the total size in bytes of all the attributes that correspond to the given field, method or class access flags and signature. This size includes the 6 header bytes (attribute_name_index and attribute_length) per attribute. Also adds the attribute type names to the constant pool.
|
getAttributeCount | back to summary |
---|---|
pack-priv final int getAttributeCount() Returns the number of attributes of the attribute list that begins with this attribute.
|
getLabels | back to summary |
---|---|
protected Label[] getLabels() Returns the labels corresponding to this attribute.
|
isCodeAttribute | back to summary |
---|---|
public boolean isCodeAttribute() Returns true if this type of attribute is a Code attribute.
|
isUnknown | back to summary |
---|---|
public boolean isUnknown() Returns true if this type of attribute is unknown. This means that the attribute content can't be parsed to extract constant pool references, labels, etc. Instead, the attribute content is read as an opaque byte array, and written back as is. This can lead to invalid attributes, if the content actually contains constant pool references, labels, or other symbolic references that need to be updated when there are changes to the constant pool, the method bytecode, etc. The default implementation of this method always returns true.
|
putAttributes | back to summary |
---|---|
pack-priv final void putAttributes(final SymbolTable symbolTable, final ByteVector output) Puts all the attributes of the attribute list that begins with this attribute, in the given byte vector. This includes the 6 header bytes (attribute_name_index and attribute_length) per attribute.
|
putAttributes | back to summary |
---|---|
pack-priv final void putAttributes(final SymbolTable symbolTable, final byte[] code, final int codeLength, final int maxStack, final int maxLocals, final ByteVector output) Puts all the attributes of the attribute list that begins with this attribute, in the given byte vector. This includes the 6 header bytes (attribute_name_index and attribute_length) per attribute.
|
putAttributes | back to summary |
---|---|
pack-priv static void putAttributes(final SymbolTable symbolTable, final int accessFlags, final int signatureIndex, final ByteVector output) Puts all the attributes that correspond to the given field, method or class access flags and signature, in the given byte vector. This includes the 6 header bytes (attribute_name_index and attribute_length) per attribute.
|
read | back to summary |
---|---|
protected Attribute read(final ClassReader classReader, final int offset, final int length, final char[] charBuffer, final int codeAttributeOffset, final Label[] labels) Reads a
|
write | back to summary |
---|---|
protected ByteVector write(final ClassWriter classWriter, final byte[] code, final int codeLength, final int maxStack, final int maxLocals) Returns the byte array form of the content of this attribute. The 6 header bytes (attribute_name_index and attribute_length) must not be added in the returned ByteVector.
|
Modifier and Type | Field and Description |
---|---|
private Attribute[] | |
private int | |
private static final int |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
private void | |
pack-priv void | |
private boolean | |
pack-priv Attribute[] |
data | back to summary |
---|---|
private Attribute[] data |
size | back to summary |
---|---|
private int size |
SIZE_INCREMENT | back to summary |
---|---|
private static final int SIZE_INCREMENT |
Set | back to summary |
---|---|
pack-priv Set() |
add | back to summary |
---|---|
private void add(final Attribute attribute) |
addAttributes | back to summary |
---|---|
pack-priv void addAttributes(final Attribute attributeList) |
contains | back to summary |
---|---|
private boolean contains(final Attribute attribute) |
toArray | back to summary |
---|---|
pack-priv Attribute[] toArray() |