Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 351179

Summary: [1.7] [clean up] to convert multiple catch blocks to a single multi-catch block and vice versa
Product: [Eclipse Project] JDT Reporter: Deepak Azad <deepakazad>
Component: UIAssignee: Fabrice Tiercelin <fabrice.tiercelin>
Status: CLOSED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: carsten.hammer, daniel_megert, deepakazad, fabian.pfaff, fabrice.tiercelin, Lars.Vogel, markus.kell.r, pbenedict
Version: 3.7Keywords: usability
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Deepak Azad CLA 2011-07-05 09:03:18 EDT
We already have quick assists to convert multiple catch blocks to a single multi-catch block and vice versa (bug 348061) and these could be made available as a cleanup. 

The clean-up options will go under 'Code Style' tab.
Comment 1 Paul Benedict CLA 2012-01-05 10:51:33 EST
Before you implement this, I think bug 366453 and this should be fixed. Place your cursor on the second catch block and combine them via quick assist. 

Before:
try {
    new FileWriter("");
} 
catch (FileNotFoundException e) { } 
catch (IOException e) { }

Result:
try {
    new FileWriter("");
} catch (FileNotFoundException | IOException e) { }

This is a compiler error; it is not valid for catch blocks to have a union of types that are in a subtype/supertype relationship.
Comment 2 Lars Vogel CLA 2020-05-05 04:20:46 EDT
Adding Carsen, who did such cleanups (manual or maybe via Netbeans) in the past for the Eclipse code base.
Comment 3 Fabrice Tiercelin CLA 2021-01-16 09:54:44 EST

*** This bug has been marked as a duplicate of bug 569879 ***