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

Bil Lewis <[email protected]> Thu, 18 Jan 2007 10:18:48 -0500
Newsgroups gmane.comp.jakarta.bcel.user
Message-ID <[email protected]>
Arrin,

Yeah. That makes sense. Why teh !@#$ did they have to change it?

Thing is, I covered the case of no LVT, just not incomplete LVT.
And it's messy in there.

Bitch, bitch, bitch.

Thank you very much.

-Bil



> Hi Bil
>
> My understanding is that the Local Variable Table is an optional 
> inclusion with a method.
>
> A method does not need to have a Local Varible Table, If it does have 
> a LVT I am not sure whether or not it is required to be correct.
>
> I don't know the specifics of your project but it might be worthwhile 
> considering the possibility that some code will not have a local 
> variable table at all or if it is the information in the local 
> variable table is incorrect.
>
> org.apache.bcel.generic.Type has a couple of static methods which 
> convert either type signatures to a Type object or a method signature 
> to an array of Types. (see getType(String) and 
> getArgumentTypes(String)) these mean you don't have to manually parse 
> the method signature.
>
> Hope this helps
>
> Bye Arrin
>
> Bil Lewis wrote:
>
>> Hi all.
>>
>> I've just been trying to update my code to run on code compiled under 
>> 1.5.
>> Almost everything works flawlessly. Just this one thing...
>>
>> For code like this:
>>
>> static void startTarget(Class clazz) { // Only called from event thread.
>>        final Class clazzz = clazz;
>>
>>        new TestInnerClass() {
>>            public void run() {
>>                Class c = clazzz;
>>            }
>>        };
>>    }
>>
>> where the variable clazzz must be passed to the inner class 
>> TestInnerClass$1, the 1.5
>> compiler does not include it in the LVT, unlike 1.4. Here's the 
>> constructor in question:
>>
>>
>> TestInnerClass$1(java.lang.Class);
>>  Signature: (Ljava/lang/Class;)V
>>  Code:
>>   0:    aload_0
>>   1:    aload_1
>>   2:    putfield    #11; //Field val$clazzz:Ljava/lang/Class;
>>   5:    aload_0
>>   6:    invokespecial    #14; //Method TestInnerClass."<init>":()V
>>   9:    return
>>
>>  LineNumberTable:
>>   line 1: 0
>>   line 10: 5
>>  LocalVariableTable:
>>   Start  Length  Slot  Name   Signature
>>   0      10      0    this       LTestInnerClass$1;
>>
>> As is clear, the parameter in register 1 is not in the LVT. As near 
>> as I've been able to make
>> out, the only way to find out that it even exists is to parse the 
>> string in the signature. This
>> seems like an exceedingly awkward thing to do.
>>
>> Ideas?
>>
>> -Bil
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>