Community
Participate
Working Groups
This will compile with javac (tested on openjdk 8) but not with Eclipse: import java.net.URI; import java.net.URISyntaxException; public class EvilFinal { public URI doEvil() { final String test; try { return new URI("x"); } catch (URISyntaxException e) { test = e.getMessage(); } catch (RuntimeException e) { test = e.getClass().getName(); } System.out.println(test); return null; } } It will complain in the second catch block, that »The final local variable test may already have been assigned« The version dial won't let me select the JDT version eclipse reports: Eclipse Java Development Tools 3.17.0.v20190307-0500 org.eclipse.jdt.feature.group
Interesting. I see this also in 4.6.3 Eclipse, nothing new.
Thanks, I can reproduce all the way back to ECJ 3.0.2 (oldest jar I have on my disk). Interestingly, also javac versions <= 1.7 complain: EvilFinal.java:12: error: variable test might already have been assigned test = e.getClass().getName(); ^ 1 error Need to figure out, if JLS has changed in this regard, or if that change in javac was a bug fix.
Bulk move to 4.14
Bulk move of unassigned bugs to 4.15
Bulk move to 4.16
Bulk move of unassigned bugs to 4.17
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.