Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313515

Summary: Unreachable code treated like dead code
Product: [Eclipse Project] JDT Reporter: Marvin Fröhlich <eclipse>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Marvin Fröhlich CLA 2010-05-19 08:44:36 EDT
Build Identifier: 20090920-1017

The following code is not compilable.

##############
public void test()
{
    return;
    
    System.out.println( "sdfsdf" );
}
##############

The sysout will be marked as unreachable code. Even if this is true, I would like this to be handled like dead code and only warned about. Sometimes it is handy to just add a return statement to not execute the following code for testing. Sometimes I cannot simply comment out this code, because I already have block comments in it.

Reproducible: Always
Comment 1 Olivier Thomann CLA 2010-05-19 10:05:32 EDT
This is an error as per JLS.
Therefore this cannot be changed or make optional. It is a mandatory error.
Sorry.
Closing as INVALID.