Community
Participate
Working Groups
Using latest, the following code generates dead bytecodes: Compile this example: public class X { public static void main(String[] args) { boolean a = true, b; if (a ? false : (b = true)) a = b; System.out.println("SUCCESS"); } } We generate: public static void main(java.lang.String[] args); 0 iconst_1 1 istore_1 [a] 2 iload_1 [a] 3 ifeq 12 6 goto 20 9 goto 18 <=== THIS IS UNREACHABLE 12 iconst_1 13 dup 14 istore_2 [b] 15 ifeq 20 18 iload_2 [b] 19 istore_1 [a] 20 getstatic java.lang.System.out : java.io.PrintStream [16] 23 ldc <String "SUCCESS"> [22] 25 invokevirtual java.io.PrintStream.println(java.lang.String) : void [24] 28 return This leads to other issues with stack maps frames. Once the dead bytecodes are removed, I'll revisit it to see how the stack map frames are generated.
Variation on same issue: public static void main(String[] args) { boolean a = true, b = false; if (!(a ? true : (b = true))) a = b; System.out.println("SUCCESS"); }
Created attachment 65924 [details] Proposed patch
Olivier - pls review the patch, and cast your vote
Added BooleanTest#test039-042
+1
Released for 3.3RC1. Fixed
Enabled regression test org.eclipse.jdt.core.tests.compiler.regression.StackMapAttributeTest#test023. This test now passes.
Verified for 3.3 RC1 using I20070515-0010