| Summary: | [1.7][quick assist] Extract multi-catch type to separate catch clause | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
| Component: | UI | Assignee: | Deepak Azad <deepakazad> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | markus.kell.r, satyam.kandula |
| Version: | 3.7 | ||
| Target Milestone: | 3.7.1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Nice idea. Though we can make it more general - select one or more types and move them to a new catch block. I guess the body of the new catch block should be a copy of the current one. Fix contained in patch in bug 348860 comment 11. Fixed in BETA_JAVA7. Verified using patch 1.0.0.v20110714-1400 |
BETA_JAVA7 Add a quick fix on a type in a multi-catch clause that extracts the type into a separate catch clause. Example: Pick out NoSuchMethodException to handle it specially: package multicatch; import java.lang.reflect.InvocationTargetException; public class Reflect { public static void main(String[] args) { try { String.class.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } After this is done, it looks strange that the 'Convert to a single multi-catch block' is not available on a on a type inside a multi-catch clause. Should enable it everywhere inside the CatchClause except for the body Block.