Re: anonymous parameters missing from local variable table in 1.5?

Bil Lewis <[email protected]> Mon, 22 Jan 2007 23:03:03 -0500
Newsgroups gmane.comp.jakarta.bcel.user
Message-ID <[email protected]>
Arrin,

The parameter types are available from the MethodGenerator. The register 
indexes are not.
It makes for really ugly code if I have to special case things and 
calculate the indexes myself.

It is also true that my code is more than a little bit ugly already and 
it's hard to figure out all
the interactions.

Oh well. Much thanks.

-Bil

> Hi Bil
>
> I'm not really sure about what your using the LocalVariableTable for 
> do you need to know about all local variables or only those that hold 
> the parameters to the method? If you only need the parameters then I'd 
> be extracting these from the signature, but if you need the types of 
> all LocalVariables I can see why it would get complicated.
>
> I/We have done something like this before though using 
> ControlFlowGraph, InstructionContexts and some other classes in 
> org.apache.bcel.verifier.structurals.* these let you perform a 
> simulation of execution (recursively following different branches) 
> during which you could inspect the Stack and record the types 
> associated with various instructions encountered in for instance a 
> HashMap. One problem I found is that the JustIce  verifier found the 
> descriptions about what was a legal subroutine vague and made it's own 
> interpretation, therefore it sometimes comes up with errors 
> (Exceptions) in what you expect to be legal code. The only way I have 
> found to avoid this is to modify the Subroutines class and remove the 
> throwing of exceptions, you could catch the exception but this leaves 
> the Subrountines and ControlFlowGraph structures improperly 
> initialized. (Still it's not such a nice solution if you know a better 
> one let me know please)
>
> I hope this helps
>
> Bye Arrin
> PS: We were interested in the types being put into multi dimensional 
> arrays but I imagine you could capture the types going into 
> LocalVaraibleInstructions in much the same way.
>
>