Top Description Fields Constructors Methods
javassist.bytecode

public Class LocalVariableAttribute

extends AttributeInfo
Class Inheritance
Known Direct Subclasses
javassist.bytecode.LocalVariableTypeAttribute
Imports
java.io.DataInputStream, .IOException, java.util.Map

LocalVariableTable_attribute.

Field Summary

Modifier and TypeField and Description
public static final String
tag

The name of this attribute "LocalVariableTable".

public static final String
typeTag

The name of the attribute "LocalVariableTypeTable".

Inherited from javassist.bytecode.AttributeInfo:
constPoolinfoname

Constructor Summary

AccessConstructor and Description
public
LocalVariableAttribute(ConstPool cp)

Constructs an empty LocalVariableTable.

public
LocalVariableAttribute(ConstPool cp, String
the attribute name. LocalVariableAttribute.tag or LocalVariableAttribute.typeTag.
name
)
Deprecated

Constructs an empty LocalVariableTable.

pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addEntry(int
start_pc
startPc
,
int
length
length
,
int
name_index
nameIndex
,
int
descriptor_index
descriptorIndex
,
int
index
index
)

Appends a new entry to local_variable_table.

public int
codeLength(int
the i-th entry.
i
)

Returns local_variable_table[i].length.

public AttributeInfo
copy(ConstPool
the constant pool table used by the new copy.
newCp
,
Map<String, String>
should be null.
classnames
)

Overrides javassist.bytecode.AttributeInfo.copy.

Makes a copy.

public String
descriptor(int
the i-th entry.
i
)

Returns the type descriptor of the local variable specified by local_variable_table[i].descriptor_index.

public int
descriptorIndex(int
the i-th entry.
i
)

Returns the value of local_variable_table[i].descriptor_index.

public int
index(int
the i-th entry.
i
)

Returns local_variable_table[i].index.

pack-priv LocalVariableAttribute
makeThisAttr(ConstPool cp, byte[] dest)

public int
nameIndex(int
the i-th entry.
i
)

Returns the value of local_variable_table[i].name_index.

pack-priv void
pack-priv void
pack-priv String
renameEntry(String desc, String oldname, String newname)

pack-priv String
renameEntry(String desc, Map<String, String> classnames)

public void
shiftIndex(int
the index does not change if it is less than this value.
lessThan
,
int delta)

For each local_variable_table[i].index, this method increases index by delta.

pack-priv void
shiftPc(int where, int gapLength, boolean exclusive)

Adjusts start_pc and length if bytecode is inserted in a method body.

public String
signature(int
the i-th entry.
i
)

This method is equivalent to descriptor().

public int
signatureIndex(int
the i-th entry.
i
)

This method is equivalent to descriptorIndex().

public int
startPc(int
the i-th entry.
i
)

Returns local_variable_table[i].start_pc.

public int
tableLength()

Returns local_variable_table_length.

public String
variableName(int
the i-th entry.
i
)

Returns the name of the local variable specified by local_variable_table[i].name_index.

public String
variableNameByIndex(int
the index of the local variable.
index
)

Returns the name of the local variable with given index.

Inherited from javassist.bytecode.AttributeInfo:
copyAllgetgetConstPoolgetLengthgetNamegetRefClassesgetRefClasseslengthlookupreadremoverenameClassrenameClasssetwritewriteAll

Field Detail

tagback to summary
public static final String tag

The name of this attribute "LocalVariableTable".

typeTagback to summary
public static final String typeTag

The name of the attribute "LocalVariableTypeTable".

Constructor Detail

LocalVariableAttributeback to summary
public LocalVariableAttribute(ConstPool cp)

Constructs an empty LocalVariableTable.

LocalVariableAttributeback to summary
public LocalVariableAttribute(ConstPool cp, String name)

Deprecated

Constructs an empty LocalVariableTable.

Parameters
name:String

the attribute name. LocalVariableAttribute.tag or LocalVariableAttribute.typeTag.

Annotations
@Deprecated
Since
3.1
See Also
tag, typeTag
LocalVariableAttributeback to summary
pack-priv LocalVariableAttribute(ConstPool cp, int n, DataInputStream in) throws IOException
LocalVariableAttributeback to summary
pack-priv LocalVariableAttribute(ConstPool cp, String name, byte[] i)

Method Detail

addEntryback to summary
public void addEntry(int startPc, int length, int nameIndex, int descriptorIndex, int index)

Appends a new entry to local_variable_table.

Parameters
startPc:int

start_pc

length:int

length

nameIndex:int

name_index

descriptorIndex:int

descriptor_index

index:int

index

codeLengthback to summary
public int codeLength(int i)

Returns local_variable_table[i].length. This represents the length of the code region in which the local variable is effective.

Parameters
i:int

the i-th entry.

copyback to summary
public AttributeInfo copy(ConstPool newCp, Map<String, String> classnames)

Overrides javassist.bytecode.AttributeInfo.copy.

Makes a copy.

Parameters
newCp:ConstPool

the constant pool table used by the new copy.

classnames:Map<String, String>

should be null.

Annotations
@Override
descriptorback to summary
public String descriptor(int i)

Returns the type descriptor of the local variable specified by 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.

Parameters
i:int

the i-th entry.

descriptorIndexback to summary
public int descriptorIndex(int i)

Returns the value of 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.

Parameters
i:int

the i-th entry.

indexback to summary
public int index(int i)

Returns local_variable_table[i].index. This represents the index of the local variable.

Parameters
i:int

the i-th entry.

makeThisAttrback to summary
pack-priv LocalVariableAttribute makeThisAttr(ConstPool cp, byte[] dest)
nameIndexback to summary
public int nameIndex(int i)

Returns the value of local_variable_table[i].name_index. This represents the name of the local variable.

Parameters
i:int

the i-th entry.

renameClassback to summary
pack-priv void renameClass(String oldname, String newname)

Overrides javassist.bytecode.AttributeInfo.renameClass.

Annotations
@Override
renameClassback to summary
pack-priv void renameClass(Map<String, String> classnames)

Overrides javassist.bytecode.AttributeInfo.renameClass.

Annotations
@Override
renameEntryback to summary
pack-priv String renameEntry(String desc, String oldname, String newname)
renameEntryback to summary
pack-priv String renameEntry(String desc, Map<String, String> classnames)
shiftIndexback to summary
public void shiftIndex(int lessThan, int delta)

For each local_variable_table[i].index, this method increases index by delta.

Parameters
lessThan:int

the index does not change if it is less than this value.

shiftPcback to summary
pack-priv void shiftPc(int where, int gapLength, boolean exclusive)

Adjusts start_pc and length if bytecode is inserted in a method body.

signatureback to summary
public String signature(int i)

This method is equivalent to 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.

Parameters
i:int

the i-th entry.

See Also
descriptor(int), SignatureAttribute#toFieldSignature(String)
signatureIndexback to summary
public int signatureIndex(int i)

This method is equivalent to descriptorIndex(). If this attribute represents a LocalVariableTypeTable attribute, this method should be used instead of descriptorIndex() since the method name is more appropriate.

Parameters
i:int

the i-th entry.

See Also
descriptorIndex(int), SignatureAttribute#toFieldSignature(String)
startPcback to summary
public int startPc(int i)

Returns local_variable_table[i].start_pc. This represents the index into the code array from which the local variable is effective.

Parameters
i:int

the i-th entry.

tableLengthback to summary
public int tableLength()

Returns local_variable_table_length. This represents the number of entries in the table.

variableNameback to summary
public String variableName(int i)

Returns the name of the local variable specified by local_variable_table[i].name_index.

Parameters
i:int

the i-th entry.

variableNameByIndexback to summary
public String variableNameByIndex(int index)

Returns the name of the local variable with given index. If you want to get the parameter name of method with correct order, you should using this method.

Parameters
index:int

the index of the local variable.