Community
Participate
Working Groups
Using 1112, I got a VerifyError when trying to run the generated code for this test case: class A { A(int j) {} public static void main(String[] args) { final int i; new A(i = 1) { { System.out.print(i); } }; } } Run: java.lang.VerifyError: (class: A, method: main signature: ([Ljava/lang/String;)V) Accessing value from uninitialized register 1 Exception in thread "main" Javac 1.4.1 passes it. Javac 1.3 fails as we do. The generated bytecodes are: public static void main(String[] arg); /* Method descriptor #18 ([Ljava/lang/String;)V */ Code attribute: /* Stack: 4, Locals: 2 */ 0 new #20 A$1 3 iload_1 <<<<<<<< ILLEGAL 4 iconst_1 5 dup 6 istore_1 7 invokespecial #23 <Constructor A$1(int arg, int arg)> 10 return The javac 1.4.1 bytecodes are: public static void main(String[] arg); /* Method descriptor #11 ([Ljava/lang/String;)V */ Code attribute: /* Stack: 4, Locals: 2 */ 0 new #2 A$1 3 dup 4 iconst_1 5 dup 6 istore_1 7 iload_1 <<<<<< NOW THIS IS LEGAL 8 invokespecial #3 <Constructor A$1(int arg, int arg)> 11 pop 12 return
Seems like we should pass along synthetic arguments after user ones.
Note that javac 1.3.1 has same bug as we do.
Change summary.
Fix applied. Substantial changes are related to this adaptation: signature computation, code gen and local variable position allocation.
Verified.