Community
Participate
Working Groups
I get the compile error "Missing code implementation in the compiler" for the following class. it appears that the use of a final variable in the if (a ? b : c) is causing problems. I am using build I20100312-1448. The code does compile properly when using 3.4.2. import java.util.ArrayList; import java.util.Comparator; import java.util.List; public class Test { public static void main(String[] args) { final List yourList = new ArrayList(); final List myList = new ArrayList(); new Comparator() { public int compare(Object o1, Object o2) { compare(yourList != null ? yourList : myList, yourList); return 0; } }; } }
This is a consequence of the null analysis changes. yourList is seen as always not null. so yourList != null is always true. So the generation of myList in the conditional expression is tagged as FAKE_USED and UNREACHABLE. Once this is done, the emulated synthetic field is not created for myList and leads to the error you saw. I have a fix under testing. Thanks for the report.
In the original code I saw this in, yourList may have been null as it was the result of a method call so you may want to verify that case as well.
Created attachment 164037 [details] Proposed fix + regression test
Released for 3.6M7. org.eclipse.jdt.core.tests.compiler.regression.InnerEmulationTest#test173 org.eclipse.jdt.core.tests.compiler.regression.InnerEmulationTest#test174
*** Bug 309237 has been marked as a duplicate of this bug. ***
verified for 3.6M7 using build I20100424-2000.
Verified.