In class LocalVariableTable
public final LocalVariable getLocalVariable( int index, int pc )

will return the localvariable at the pc specified. This is new to 5.2

And yes -g is required.


----- Original Message ----- From: "Wassim Masri" <[EMAIL PROTECTED]>
To: <bcel-user@jakarta.apache.org>
Sent: Monday, May 29, 2006 3:33 PM
Subject: Is there a way to uniquely identify a local variable in BCEL?


Dear All,

Is there a way to uniquely identify a local variable in BCEL?

For instance, in the example below both of the variables x2 and x3 have an index
equal to 2. So, we cannot rely on the index alone.

static void foo( )
{
int x1= 0;
if (x1 >= 0)
{
int x2 = 0;
}

int x3 = 0;
}

I looked into using the scope (LocalVariableGen.getStart() and
LocalVariableGen.getEnd()) in addition to the index, but there does not seem to
be a way to get this information from LocalVariableInstruction.

In a related (but less critical) matter, it seems that the scope information is
only accessible when I compile the target code with the '-g' switch on.

Your help is really appreciated.

Wes





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to