Bug 308245 - Valid code fails to compile in 3.6
Summary: Valid code fails to compile in 3.6
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 309237 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-06 13:36 EDT by Michael Valenta CLA
Modified: 2010-04-26 10:53 EDT (History)
6 users (show)

See Also:


Attachments
Proposed fix + regression test (7.82 KB, patch)
2010-04-07 08:47 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Valenta CLA 2010-04-06 13:36:24 EDT
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;
			}
		};
	}
}
Comment 1 Olivier Thomann CLA 2010-04-06 14:31:58 EDT
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.
Comment 2 Michael Valenta CLA 2010-04-06 16:35:15 EDT
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.
Comment 3 Olivier Thomann CLA 2010-04-07 08:47:00 EDT
Created attachment 164037 [details]
Proposed fix + regression test
Comment 4 Olivier Thomann CLA 2010-04-07 08:47:39 EDT
Released for 3.6M7.
org.eclipse.jdt.core.tests.compiler.regression.InnerEmulationTest#test173
org.eclipse.jdt.core.tests.compiler.regression.InnerEmulationTest#test174
Comment 5 Olivier Thomann CLA 2010-04-14 18:03:16 EDT
*** Bug 309237 has been marked as a duplicate of this bug. ***
Comment 6 Ayushman Jain CLA 2010-04-26 10:02:46 EDT
verified for 3.6M7 using build I20100424-2000.
Comment 7 Jay Arthanareeswaran CLA 2010-04-26 10:53:45 EDT
Verified.