You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by wassim masri <qd...@hotmail.com> on 2004/01/31 18:43:59 UTC

Determining the scope of local variables (without the DEBUG option turned off)

I am trying to get the scope of the local variables in a method (given the 
index)

I initially thought that I can just call MethodGen.getLocalVariables(), get 
the local variables table, locate my variable given its index then get the 
scope from the LocalVariable object  (using getStartPC and getLength).

It turned out that if the target byte code is not compiled with the DEBUG 
option turned on, MethodGen.getLocalVariables() only returns entries 
corresponding to the arguments of a method and ignores the local variables 
declared inside the method

For example, in the method foo( ) below, the returned table will have a 
single entry as opposed to 3:

public static void foo (int x )
{
	int y, z;
}

Any ideas?

Thanks,
Wes

_________________________________________________________________
Check out the coupons and bargains on MSN Offers! 
http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418


---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org