Community
Participate
Working Groups
The following code has been compiled in Eclipse 3.1 RC2 (as well in 3.0.2): //-------------- public class TestBug { final boolean isA = true; public static void main(String[] args) { TestBug test = new TestBug(); System.out.println(test.isA ? "A" : "B"); } } //-------------- it is produces exception: java.lang.VerifyError: (class: TestBug, method: main signature: ([Ljava/lang/String;)V) Expecting to find integer on stack Exception in thread "main" However beeing compiled with javac it runs ok. If one removes final modifier it will run on Eclipse too, so i guess it has something to do with optimizations.
Olivier - pls investigate and attach a patch once you have it.
Created attachment 23188 [details] Proposed fix
+1 for RC3 Olivier - pls enter separate issue for codegen optimization. Fix would look like adding implicit conversion to ConditionalExpression: if (conditionType != null) condition.computeConversion(scope, BooleanBinding, conditionType); Dirk - pls cast your vote
I entered bug 100187 for the optimization issue.
Created attachment 23192 [details] Corresponding regression test
+1 for RC3.
Fixed and released in HEAD. Regression test added in org.eclipse.jdt.core.tests.compiler.regression.ConditionalExpressionTest.test001
Verified using N20050616-0010 + JDT/Core HEAD