|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavassist.bytecode.AttributeInfo
javassist.bytecode.CodeAttribute
public class CodeAttribute
Code_attribute.
To browse the code field of
a Code_attribute structure,
use CodeIterator.
CodeIterator| Nested Class Summary | |
|---|---|
static class |
CodeAttribute.RuntimeCopyException
An exception that may be thrown by copy()
in CodeAttribute. |
| Field Summary | |
|---|---|
static java.lang.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,
java.util.Map classnames)
Makes a copy. |
byte[] |
get()
This method is not available. |
AttributeInfo |
getAttribute(java.lang.String name)
Returns the attribute with the specified name. |
java.util.List |
getAttributes()
Returns attributes[]. |
byte[] |
getCode()
Returns code[]. |
int |
getCodeLength()
Returns code_length. |
java.lang.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. |
void |
insertLocalVar(int where,
int size)
Changes the index numbers of the local variables to append a new parameter. |
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 |
setAttribute(StackMapTable smt)
Adds a stack map table. |
void |
setMaxLocals(int value)
Sets max_locals. |
void |
setMaxStack(int value)
Sets max_stack. |
| Methods inherited from class javassist.bytecode.AttributeInfo |
|---|
getConstPool, getName |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String tag
"Code".
| Constructor Detail |
|---|
public CodeAttribute(ConstPool cp,
int stack,
int locals,
byte[] code,
ExceptionTable etable)
Code_attribute.
cp - constant pool tablestack - max_stacklocals - max_localscode - code[]etable - exception_table[]| Method Detail |
|---|
public AttributeInfo copy(ConstPool newCp,
java.util.Map classnames)
throws CodeAttribute.RuntimeCopyException
Map object.
copy in class AttributeInfonewCp - the constant pool table used by the new copy.classnames - pairs of replaced and substituted
class names.
CodeAttribute object.
CodeAttribute.RuntimeCopyException - if a BadBytecode
exception is thrown, it is
converted into
RuntimeCopyException.public int length()
attribute_info
structure.
The returned value is attribute_length + 6.
length in class AttributeInfopublic byte[] get()
get in class AttributeInfojava.lang.UnsupportedOperationException - always thrown.public void set(byte[] newinfo)
set in class AttributeInfojava.lang.UnsupportedOperationException - always thrown.public java.lang.String getDeclaringClass()
public int getMaxStack()
max_stack.
public void setMaxStack(int value)
max_stack.
public int computeMaxStack()
throws BadBytecode
max_stack
to the computed size.
max_stack
BadBytecode - if this method fails in computing.public int getMaxLocals()
max_locals.
public void setMaxLocals(int value)
max_locals.
public int getCodeLength()
code_length.
public byte[] getCode()
code[].
public CodeIterator iterator()
public ExceptionTable getExceptionTable()
exception_table[].
public java.util.List getAttributes()
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.
AttributeInfopublic AttributeInfo getAttribute(java.lang.String name)
name - attribute name
AttributeInfo object or null.public void setAttribute(StackMapTable smt)
smt - the stack map table added to this code attribute.
If it is null, a new stack map is not added.
Only the old stack map is removed.
public void insertLocalVar(int where,
int size)
throws BadBytecode
LocalVariableAttribute
or StackMapTable. These attributes must be
explicitly updated.
where - the index of the new parameter.size - the type size of the new parameter (1 or 2).
BadBytecodeLocalVariableAttribute.shiftIndex(int, int),
StackMapTable.insertLocal(int, int, int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||