| Summary: | [1.7][compiler] Incorrect exception handling when using try-with-resources | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Vincent PERICART <viper> |
| Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
| Status: | VERIFIED WORKSFORME | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | Olivier_Thomann, satyam.kandula, srikanth_sankaran, viper |
| Version: | 3.8 | ||
| Target Milestone: | 3.8 M2 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
This seems to be fixed in HEAD and 3.7 maintenance. Could you please provide the org.eclipse.jdt.core bundle id ? You can find it into Help>About Eclipse SDK>Installation Details>Plugins. Closing as WORKSFORME. Satyam, if you can find the duplicate, you can close it as a dup. I am not able to reproduce even with the build of I20110802-2000. Verified for 3.8M2 with build I20110911-2000 |
Build Identifier: I20110805-1200 The following snippet will compile without warning on JDK7. private static void closeThat(Closeable that) throws IOException { try (Closeable toClose = that) { // closes toClose } } Though, on Eclipse, it will output a warning ("The declared exception IOException is not actually thrown..."). Removing the exception : private static void closeThat(Closeable that) { try (Closeable toClose = that) { // closes toClose } } will pass the compiler check on Eclipse, but will fail to compile with the JDK7. It is indeed translateable to : private static void closeThat(Closeable that) { Closeable toClose = that; try { } finally { toClose.close(); // throws IOException } } Reproducible: Always Steps to Reproduce: 1. Input provided code in Eclipse Java editor