javassist.bytecode
public class CodeAttribute extends AttributeInfo implements Opcode
Code_attribute
.
To browse the code
field of
a Code_attribute
structure,
use CodeIterator
.
See Also: CodeIterator
Nested Class Summary | |
---|---|
static class | CodeAttribute.RuntimeCopyException
An exception that may be thrown by copy()
in CodeAttribute . |
Field Summary | |
---|---|
static String | tag
The name of this attribute "Code" . |
Constructor Summary | |
---|---|
CodeAttribute(ConstPool cp, int stack, int locals, byte[] code, ExceptionTable etable)
Constructs a Code_attribute .
|
Method Summary | |
---|---|
int | computeMaxStack()
Computes the maximum stack size and sets max_stack
to the computed size.
|
AttributeInfo | copy(ConstPool newCp, Map classnames)
Makes a copy. |
byte[] | get()
This method is not available.
|
AttributeInfo | getAttribute(String name)
Returns the attribute with the specified name.
|
List | getAttributes()
Returns attributes[] .
|
byte[] | getCode()
Returns code[] . |
int | getCodeLength()
Returns code_length . |
String | getDeclaringClass()
Returns the name of the class declaring the method including
this code attribute. |
ExceptionTable | getExceptionTable()
Returns exception_table[] . |
int | getMaxLocals()
Returns max_locals . |
int | getMaxStack()
Returns max_stack . |
CodeIterator | iterator()
Makes a new iterator for reading this code attribute. |
int | length()
Returns the length of this attribute_info
structure.
|
void | set(byte[] newinfo)
This method is not available.
|
void | setMaxLocals(int value)
Sets max_locals . |
void | setMaxStack(int value)
Sets max_stack . |
"Code"
.Code_attribute
.
Parameters: cp constant pool table stack max_stack
locals max_locals
code code[]
etable exception_table[]
max_stack
to the computed size.
Returns: the newly computed value of max_stack
Throws: BadBytecode if this method fails in computing.
Map
object.
Parameters: newCp the constant pool table used by the new copy. classnames pairs of replaced and substituted class names.
Returns: CodeAttribute
object.
Throws: RuntimeCopyException if a BadBytecode
exception is thrown, it is
converted into
RuntimeCopyException
.
Throws: java.lang.UnsupportedOperationException always thrown.
Parameters: name attribute name
Returns: an AttributeInfo
object or null.
attributes[]
.
It returns a list of AttributeInfo
.
A new element can be added to the returned list
and an existing element can be removed from the list.
See Also: AttributeInfo
code[]
.code_length
.exception_table[]
.max_locals
.max_stack
.attribute_info
structure.
The returned value is attribute_length + 6
.Throws: java.lang.UnsupportedOperationException always thrown.
max_locals
.max_stack
.