Bug 51945 - Unreachable code error cannot be turned off/reduced in severity
Summary: Unreachable code error cannot be turned off/reduced in severity
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-13 05:35 EST by Mark Cooke CLA
Modified: 2004-02-13 06:16 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Cooke CLA 2004-02-13 05:35:59 EST
The following code, under M6 (and M5) will not successfully compile:
public class tester {
	public int testmethod()
	{
		int itest = 0;
		return itest;;
	}
}

Initially I went into the "project->compiler->unused code" tab and changed the 
"unnecessary semicolon" option to warning, then ignore.  Didn't make any 
difference - perhaps because it's after a return?
Eclipse 2 had an "Unreachable code" option under the problems tab - has this 
been acidentally missed in 3?
Comment 1 Philipe Mulet CLA 2004-02-13 06:15:53 EST
We did remove the setting to control the severity of unreachable code as this 
was breaking the language spec which states that this is an error. 

Note: we did introduce this setting historically to ease migration from people 
coming from different tools.

Now you need to understand 2 things:
- we have added a warning to diagnose unnecessary empty statements
- Java 1.4 treats semicolons as empty statements. 'return itest;;' is really 2 
statements: a return statement followed by an empty one. Java 1.3 did not 
consider extra semicolons as real statements, and thus did not complain.

So you have 2 options:
- switch compiler compliance back to 1.3
- remove the extra semicolon (what value does it provide?)

Comment 2 Philipe Mulet CLA 2004-02-13 06:16:10 EST
Working as designed