Bug 258887 - [compiler] Enhanced "never read" warning
Summary: [compiler] Enhanced "never read" warning
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-15 19:00 EST by Carl Manaster CLA
Modified: 2009-05-05 12:33 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carl Manaster CLA 2008-12-15 19:00:07 EST
If a local variable is assigned, but not read after the assignment, that would be a nice Unnecessary Code warning, too.

private void currentWarning() {
	int x = 0;	// this generates the "Local variable is
			// never read" warning
}

private void proposedWarning() {
	int x = 0;
	if (x > 0)	// since we are using x here, there is no warning above;
		return;
	x = 7;		// this is where I propose a new warning, because we're
			// done with x already; setting its value is of no use.
}
Comment 1 Philipe Mulet CLA 2008-12-16 07:53:56 EST
I think you are asking to detect dead value store. This would indeed by a nice addition. 
Comment 2 Mike Wilson CLA 2009-05-05 12:33:58 EDT
Changing Version tag to something more believable. Note that this is not a statement about when the enhancement request will be addressed (the Target Milestone field is used for that); the Version tag should be set to the version of Eclipse you were using when you saw the need for the enhancement.