| Summary: | [1.7][quick fix] Adding unhandled exceptions on resource declarations performs wrong action | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Ayushman Jain <amj87.iitr> | ||||
| Component: | UI | Assignee: | Deepak Azad <deepakazad> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | deepakazad, markus.kell.r, Michael_Rennie | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.7.1 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
I will take a look. *** Bug 348867 has been marked as a duplicate of this bug. *** Created attachment 198074 [details]
fix + tests
Fixed in BETA_JAVA7
. verified |
BETA_JAVA7 public class Snippet { static void m(int n) throws IllegalArgumentException, MyException { if (n == 1) throw new IllegalArgumentException(); else throw new MyException(); } void foo(String name, boolean b) { try (FileInputStream fis = new FileInputStream(name)) { // use quick fix here m(1); } System.out.println("SUCCESS"); } } class MyException extends Exception{ } Using quick fix at the location marked above i.e. for the error "unhandled exception type FileNotFoundException" adds the thrown exceptions from method 'm(int)' instead of adding FileNotFoundException. Since the exception still remains, again see the available quick fixes for correcting the error. This time, the "add throws declaration" quick fix is not even available. The latter also happens in case the call m(1) is removed.