Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313515 - Unreachable code treated like dead code
Summary: Unreachable code treated like dead code
Status: CLOSED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-19 08:44 EDT by Marvin Fröhlich CLA
Modified: 2010-05-19 10:05 EDT (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 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.