Bug 466406 - [compile] valid final variable causes eclipse compilation error when set via multiple catch blocks
Summary: [compile] valid final variable causes eclipse compilation error when set via ...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.5   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2015-05-05 06:40 EDT by Gary Morgan CLA
Modified: 2022-07-24 02:24 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 Gary Morgan CLA 2015-05-05 06:40:06 EDT
This class generates a compile error in the IDE but javac compiles successfully.

public class ExceptionTest {

    public void doStuff() throws Exception {
    }

    public void test() {
        final Exception ex;
        try {
            doStuff();
            return;
        } catch (NullPointerException e) {
            ex = e;
        } catch (Exception e) {
            // compile error here, only in the IDE
            ex = e;
        }
        ex.printStackTrace();
    }
}
Comment 1 Stephan Herrmann CLA 2015-05-05 09:33:42 EDT
Thanks for the report.

The program is rejected for the same reason by these compiler versions:

ecj: all versions since at least 3.2.2

javac: all versions <= jdk1.8.0-lambda-b69

Ergo: javac 1.8.0 (GA) is the first compiler I could find on my disk, that accepts the program; which makes this a fairly recent bug fix in javac. We should fix accordingly.

There might even be a spec change behind this, which slipped our attention?
OTOH, javac 1.8 with -source 1.7 accepts the program, too, so oracle didn't bother about compatibility between old compiler and new compiler at -source 1.7.

I'm still not sure if we should fix it for all versions or only for 1.8 (for bug-compatibility with old oracle compilers)?
Comment 2 Manoj N Palat CLA 2018-05-17 03:23:45 EDT
bulk move out of 4.8
Comment 3 Manoj N Palat CLA 2018-08-16 00:09:14 EDT
Bulk move out of 4.9
Comment 4 Eclipse Genie CLA 2022-07-24 02:24:52 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.