public class LocalVariableAttribute extends AttributeInfo
LocalVariableTable_attribute
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
tag
The name of this attribute
"LocalVariableTable" . |
static java.lang.String |
typeTag
The name of the attribute
"LocalVariableTypeTable" . |
constPool, info, name
Constructor and Description |
---|
LocalVariableAttribute(ConstPool cp)
Constructs an empty LocalVariableTable.
|
LocalVariableAttribute(ConstPool cp,
int n,
java.io.DataInputStream in) |
LocalVariableAttribute(ConstPool cp,
java.lang.String name)
Deprecated.
|
LocalVariableAttribute(ConstPool cp,
java.lang.String name,
byte[] i) |
Modifier and Type | Method and Description |
---|---|
void |
addEntry(int startPc,
int length,
int nameIndex,
int descriptorIndex,
int index)
Appends a new entry to
local_variable_table . |
int |
codeLength(int i)
Returns
local_variable_table[i].length . |
AttributeInfo |
copy(ConstPool newCp,
java.util.Map classnames)
Makes a copy.
|
java.lang.String |
descriptor(int i)
Returns the type descriptor of the local variable
specified by
local_variable_table[i].descriptor_index . |
int |
descriptorIndex(int i)
Returns the value of
local_variable_table[i].descriptor_index . |
int |
index(int i)
Returns
local_variable_table[i].index . |
(package private) LocalVariableAttribute |
makeThisAttr(ConstPool cp,
byte[] dest) |
int |
nameIndex(int i)
Returns the value of
local_variable_table[i].name_index . |
(package private) void |
renameClass(java.util.Map classnames) |
(package private) void |
renameClass(java.lang.String oldname,
java.lang.String newname) |
(package private) java.lang.String |
renameEntry(java.lang.String desc,
java.util.Map classnames) |
(package private) java.lang.String |
renameEntry(java.lang.String desc,
java.lang.String oldname,
java.lang.String newname) |
void |
shiftIndex(int lessThan,
int delta)
For each
local_variable_table[i].index ,
this method increases index by delta . |
(package private) void |
shiftPc(int where,
int gapLength,
boolean exclusive)
Adjusts start_pc and length if bytecode is inserted in a method body.
|
java.lang.String |
signature(int i)
This method is equivalent to
descriptor() . |
int |
signatureIndex(int i)
This method is equivalent to
descriptorIndex() . |
int |
startPc(int i)
Returns
local_variable_table[i].start_pc . |
int |
tableLength()
Returns
local_variable_table_length . |
java.lang.String |
variableName(int i)
Returns the name of the local variable
specified by
local_variable_table[i].name_index . |
copyAll, get, getConstPool, getLength, getName, getRefClasses, getRefClasses, length, lookup, read, remove, renameClass, renameClass, set, write, writeAll
public static final java.lang.String tag
"LocalVariableTable"
.public static final java.lang.String typeTag
"LocalVariableTypeTable"
.public LocalVariableAttribute(ConstPool cp)
public LocalVariableAttribute(ConstPool cp, java.lang.String name)
LocalVariableAttribute(ConstPool cp, int n, java.io.DataInputStream in) throws java.io.IOException
java.io.IOException
LocalVariableAttribute(ConstPool cp, java.lang.String name, byte[] i)
public void addEntry(int startPc, int length, int nameIndex, int descriptorIndex, int index)
local_variable_table
.startPc
- start_pc
length
- length
nameIndex
- name_index
descriptorIndex
- descriptor_index
index
- index
void renameClass(java.lang.String oldname, java.lang.String newname)
renameClass
in class AttributeInfo
java.lang.String renameEntry(java.lang.String desc, java.lang.String oldname, java.lang.String newname)
void renameClass(java.util.Map classnames)
renameClass
in class AttributeInfo
java.lang.String renameEntry(java.lang.String desc, java.util.Map classnames)
public void shiftIndex(int lessThan, int delta)
local_variable_table[i].index
,
this method increases index
by delta
.lessThan
- the index does not change if it
is less than this value.public int tableLength()
local_variable_table_length
.
This represents the number of entries in the table.public int startPc(int i)
local_variable_table[i].start_pc
.
This represents the index into the code array from which the local
variable is effective.i
- the i-th entry.public int codeLength(int i)
local_variable_table[i].length
.
This represents the length of the code region in which the local
variable is effective.i
- the i-th entry.void shiftPc(int where, int gapLength, boolean exclusive)
public int nameIndex(int i)
local_variable_table[i].name_index
.
This represents the name of the local variable.i
- the i-th entry.public java.lang.String variableName(int i)
local_variable_table[i].name_index
.i
- the i-th entry.public int descriptorIndex(int i)
local_variable_table[i].descriptor_index
.
This represents the type descriptor of the local variable.
If this attribute represents a LocalVariableTypeTable attribute,
this method returns the value of
local_variable_type_table[i].signature_index
.
It represents the type of the local variable.
i
- the i-th entry.public int signatureIndex(int i)
descriptorIndex()
.
If this attribute represents a LocalVariableTypeTable attribute,
this method should be used instead of descriptorIndex()
since the method name is more appropriate.i
- the i-th entry.descriptorIndex(int)
,
SignatureAttribute.toFieldSignature(String)
public java.lang.String descriptor(int i)
local_variable_table[i].descriptor_index
.
If this attribute represents a LocalVariableTypeTable attribute,
this method returns the type signature of the local variable
specified by local_variable_type_table[i].signature_index
.
i
- the i-th entry.public java.lang.String signature(int i)
descriptor()
.
If this attribute represents a LocalVariableTypeTable attribute,
this method should be used instead of descriptor()
since the method name is more appropriate.
To parse the string, call toFieldSignature(String)
in SignatureAttribute
.
i
- the i-th entry.descriptor(int)
,
SignatureAttribute.toFieldSignature(String)
public int index(int i)
local_variable_table[i].index
.
This represents the index of the local variable.i
- the i-th entry.public AttributeInfo copy(ConstPool newCp, java.util.Map classnames)
copy
in class AttributeInfo
newCp
- the constant pool table used by the new copy.classnames
- should be null.LocalVariableAttribute makeThisAttr(ConstPool cp, byte[] dest)