Bug 44327 - new compiler option...
Summary: new compiler option...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.0   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-07 12:40 EDT by Alvin Thompson CLA
Modified: 2005-08-30 14:35 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alvin Thompson CLA 2003-10-07 12:40:38 EDT
...warn possibly incorrect conditional:
if (foo);

while (foo); {
    ...
}

for (int x=0;i<len;i++); {
    ...
}

etc.

the first should warn if there are (likely) no side-effects.

the last two (with proceeding '{') should always warn. this can be even more
general as any time you have a '{' after a ';' (in a method) it is likely an
error (though not always).
Comment 1 Olivier Thomann CLA 2003-10-07 13:49:53 EDT
This is an enhancement, not a bug.
Comment 2 Alvin Thompson CLA 2003-10-07 14:01:07 EDT
whoops, my mistake. thought i set it.
Comment 3 Philipe Mulet CLA 2003-10-08 04:40:05 EDT
these are good suggestions, unclear we will throw some more in for 3.0, may 
rather keep for later.
Comment 4 Philipe Mulet CLA 2003-10-08 06:18:15 EDT
defer
Comment 5 Alvin Thompson CLA 2005-08-02 12:31:10 EDT
post 3.0 :)
Comment 6 Olivier Thomann CLA 2005-08-30 14:35:33 EDT
This is fixed in 3.0 with the Empty statement error/warning.

If you have this code:
public class X {
	public static final void main(String args[]) {
		boolean foo = false;
		if (foo);

		while (foo); {
		}

		for (int i=0, len = 10;i<len;i++); {
		}
	}
}

All ';' are reported as "Empty control-flow statement".

Closing as FIXED.
Comment 7 Olivier Thomann CLA 2005-08-30 14:35:45 EDT
Verified in 3.0.2.