Community
Participate
Working Groups
I am getting VerifyErrors on 3.1 RC3 (I20050617-1618). This looks similar to bug 69776. I believe that this is due to incorrect bytecode being generated, missing casts, to deal with unboxing and reboxing a generic Integer with a "--" operation (I presume this is valid java!?- if not, i should be warned, and it should not appear to compile fine!). Test case: public final class Pair<F,S> { public F first; public S second; public static <F,S> Pair<F,S> create(F f, S s) { return new Pair<F,S>(f,s); } public Pair(final F f, final S s) { first = f; second = s; } } public class A { public void a() { Pair<Integer,Integer> p = Pair.create(1,3); p.first--; } public static void main(final String[] args) { new A().a(); } } I get: Exception in thread "main" java.lang.VerifyError: (class: A, method: a signature: ()V) Incompatible object argument for function call Comment out the line "p.first--;" and it runs fine. linux-gtk x86 32bit java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition java.runtime.version=1.5.0-b64 Thanks, Tim
Reproduced.
Offending sequence is in method a() 12 aload_1 [p] 13 dup 14 getfield Pair.first : Object [30] 17 invokevirtual Integer.intValue() : int [34] 20 iconst_1 21 isub 22 invokestatic Integer.valueOf(int) : Integer [20] 25 putfield Pair.first : Object [30] 28 return before bytecode at 17, a checkcast Integer should be issue.
Similar weaknesses spotted for prefix operators as well, and for all single/qualified/field references. Added AutoboxingTest#test105-109.
Actually regression tests are: AutoboxingTest#test105-108.
Fixed in 3.1 maintenance branch
*** Bug 105524 has been marked as a duplicate of this bug. ***
Verified in 3.2 M1 with build I20050808-2000.
Verified using M20050923-1430 for 3.1.1