Bug 100369 - [compiler] No effect assignment diagnosis could be made smarter
Summary: [compiler] No effect assignment diagnosis could be made smarter
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 100368 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-16 06:29 EDT by Philipe Mulet CLA
Modified: 2006-03-27 09:20 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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