Top Description Fields Constructors Methods
org.apache.bcel.verifier.statics

public Class LocalVariableInfo

extends Object
Class Inheritance
Imports
java.util.Hashtable, org.apache.bcel.generic.Type, org.apache.bcel.verifier.exc.LocalVariableInfoInconsistentException

A utility class holding the information about the name and the type of a local variable in a given slot (== index). This information often changes in course of byte code offsets.

Field Summary

Modifier and TypeField and Description
private final Hashtable<String, String>
names

The names database.

private final Hashtable<String, Type>
types

The types database.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
add(final int offset, final String name, final Type t)

Adds information about name and type for a given offset.

public void
add(final String
variable name
name
,
final int
Range in which the variable is valid.
startPc
,
final int
length of ...
length
,
final Type
variable type
type
)

Adds some information about this local variable (slot).

public String

Returns:

the name of the local variable that uses this local variable slot at the given bytecode offset.
getName
(final int
bytecode offset.
offset
)

Returns the name of the local variable that uses this local variable slot at the given bytecode offset.

public Type

Returns:

the type of the local variable that uses this local variable slot at the given bytecode offset.
getType
(final int
bytecode offset.
offset
)

Returns the type of the local variable that uses this local variable slot at the given bytecode offset.

private void
setName(final int offset, final String name)

Adds a name of a local variable and a certain slot to our 'names' (Hashtable) database.

private void
setType(final int offset, final Type t)

Adds a type of a local variable and a certain slot to our 'types' (Hashtable) database.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

namesback to summary
private final Hashtable<String, String> names

The names database. KEY: String representing the offset integer.

typesback to summary
private final Hashtable<String, Type> types

The types database. KEY: String representing the offset integer.

Constructor Detail

LocalVariableInfoback to summary
public LocalVariableInfo()

Method Detail

addback to summary
private void add(final int offset, final String name, final Type t) throws LocalVariableInfoInconsistentException

Adds information about name and type for a given offset.

Exceptions
LocalVariableInfoInconsistentException:
if the new information conflicts with already gathered information.
addback to summary
public void add(final String name, final int startPc, final int length, final Type type) throws LocalVariableInfoInconsistentException

Adds some information about this local variable (slot).

Parameters
name:String

variable name

startPc:int

Range in which the variable is valid.

length:int

length of ...

type:Type

variable type

Exceptions
LocalVariableInfoInconsistentException:
if the new information conflicts with already gathered information.
getNameback to summary
public String getName(final int offset)

Returns the name of the local variable that uses this local variable slot at the given bytecode offset. Care for legal bytecode offsets yourself, otherwise the return value might be wrong. May return 'null' if nothing is known about the type of this local variable slot at the given bytecode offset.

Parameters
offset:int

bytecode offset.

Returns:String

the name of the local variable that uses this local variable slot at the given bytecode offset.

getTypeback to summary
public Type getType(final int offset)

Returns the type of the local variable that uses this local variable slot at the given bytecode offset. Care for legal bytecode offsets yourself, otherwise the return value might be wrong. May return 'null' if nothing is known about the type of this local variable slot at the given bytecode offset.

Parameters
offset:int

bytecode offset.

Returns:Type

the type of the local variable that uses this local variable slot at the given bytecode offset.

setNameback to summary
private void setName(final int offset, final String name)

Adds a name of a local variable and a certain slot to our 'names' (Hashtable) database.

setTypeback to summary
private void setType(final int offset, final Type t)

Adds a type of a local variable and a certain slot to our 'types' (Hashtable) database.