bytecode error in autoboxing?

John White <JohnWhite-1VmriVQ4F2F8UrSeD/[email protected]>
Newsgroups gmane.comp.java.beanshell.devel
Message-ID <1083619991.19123.12820.camel@rei>
the following class causes a VerifyError
when run through bsh:

public class Sigma {
    private double sum = 0.0;

    public double update(double x) {
        sum += x;
        return sum;
    }
}

the error occurs with the single parameter "x"
to update(). if i use a java.lang.Double instead
of the primitive double, the class works
correctly.

the error is:

Exception in thread "main" java.lang.VerifyError: (class: Sigma, method:
update signature: (D)D) Register 1 contains wrong type
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:1514)
        at java.lang.Class.getField0(Class.java:1841)
        at java.lang.Class.getField(Class.java:909)
        at bsh.Reflect.findAccessibleField(Unknown Source)
        at bsh.Reflect.resolveExpectedJavaField(Unknown Source)
        at bsh.Reflect.getLHSStaticField(Unknown Source)
        at bsh.ClassGeneratorImpl.generateClassImpl(Unknown Source)
        at bsh.ClassGeneratorImpl.generateClass(Unknown Source)
        at bsh.BSHClassDeclaration.eval(Unknown Source)
        at bsh.Interpreter.eval(Unknown Source)
        at bsh.Interpreter.source(Unknown Source)
        at bsh.Interpreter.main(Unknown Source)


this is with sun's jdk. i get a similar error with
ibm's jdk, although it reports it as "Localvariable1 contains wrong
type".

i'm running with bsh-2.0b1 (which apparently was not
compiled with -g). i'm unable to access anonymous cvs
at the moment; it just hangs after the passwd prompt.
i'll try it with cvs when that's up.

john


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.