Bug 100369

Summary: [compiler] No effect assignment diagnosis could be made smarter
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jerome_lanneluc
Version: 3.1   
Target Milestone: 3.2 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Philipe Mulet CLA 2005-06-16 06:29:02 EDT
Build 3.1rc2

The following cases could be diagnosed as having little effect:
public class X {
	
	void foo() {
		int length1 = 0;
		length1 = length1; // already detected
		
		int length2 = length2 = 0; // not detected

		int length3 = 0;
		length3 = length3 = 0; // not detected
	}
}
Comment 1 Philipe Mulet CLA 2005-06-16 09:03:26 EDT
*** Bug 100368 has been marked as a duplicate of this bug. ***
Comment 2 Philipe Mulet CLA 2006-02-20 07:20:39 EST
Other case where can complain: 
a = ++a
Comment 3 Philipe Mulet CLA 2006-02-20 07:48:18 EST
Considering for 3.2.
Also will take out the codegen optimizing for this scenario, which is fairly dangerous (i.e. not generating the assignment is risky, if a bug in detection of this diagnosis, it could ruin the generated code entirely as observed in bug 111898).

Added AssignmentTest#test044 and tuned other affected tests.
Comment 4 David Audel CLA 2006-03-27 09:20:52 EST
Verified for 3.2 M6 using build I20060327-0010