jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bil Lewis <...@LambdaCS.com>
Subject Re: anonymous parameters missing from local variable table in 1.5?
Date Sun, 21 Jan 2007 20:26:17 GMT
Arrin, et. al.,

I spent a little time hacking around, trying to see if I could finesse 
the problem.
It wasn't pretty.

Either I have gobs of little special cases distributed throughout my 
code, or I find
a way to make the LVT reflect reality. The former is a disaster. The 
latter involves
modifying BCEL.

As other folks have probably run into this, perhaps it's already been done?

-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: bcel-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>>
>


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


Mime
View raw message