| Summary: | [1.7] Unhandled exception type Exception | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Volker Berlin <volker.berlin> | ||||||
| Component: | Core | Assignee: | Satyam Kandula <satyam.kandula> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | deepakazad, Olivier_Thomann, remy.suen, srikanth_sankaran | ||||||
| Version: | 3.7 | ||||||||
| Target Milestone: | 3.7.1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Satyam, please investigate. Minimal, yet full test case:
public class X {
public static void main(String[] args) {
try {
throw new Exception();
} catch (Exception e) {
if (e instanceof RuntimeException)
throw (RuntimeException) e;
}
}
}
Compiles fine with JDK 7b142.
Satyam, this should be treated as a serious bug and should be fixed
asap. Thanks.
Created attachment 198619 [details]
Plausible patch
Not fully tested.
Basically the new Java 7 rethrow semantics should kick
in only when the catch parameter is directly rethrown.
(In reply to comment #3) > Created attachment 198619 [details] > Plausible patch > > Not fully tested. > > Basically the new Java 7 rethrow semantics should kick > in only when the catch parameter is directly rethrown. Srikanth, Thanks for the patch. This patch looks good. I have added a test and running the test suite. Will release once the tests are good. Created attachment 198639 [details]
Patch + tests
Updated the patch slightly and added test.
Released in BETA_JAVA7 branch. Verified with v20110714-1300. |
The file javax.management.remote.rmi.RMIConnectionImpl of the JDK 7 show the follow compiler error with "Java 7 Support in Eclipse JDT (BETA)". I use Version Eclipse 4.1. The error message is: Unhandled exception type Exception It is produced from the follow catch block: } catch (Exception e) { if (e instanceof RuntimeException) throw (RuntimeException) e; // this line show the error throw new PrivilegedActionException(e); } The problem seems that the cast to a RuntimeException is ignored. Volker