Community
Participate
Working Groups
Paste in the following code into the package explorer ######### import java.io.FileNotFoundException; import java.io.IOException; class MultiCatch { void foo() { try { throw new IOException(); } catch (FileNotFoundException | IOException ex) { } } } ######## Notice that there is an error for the catch block. There is a quick assist to separate the catch blocks, but there should be a quick fix to separate the catch clauses.
I filed this before reading bug 348860 completely. I see that the main concern is that there may be many quick fixes otherwise. Can't we propose to separate out the only selected catch argument?
(In reply to comment #1) > I filed this before reading bug 348860 completely. I see that the main concern > is that there may be many quick fixes otherwise. Can't we propose to separate > out the only selected catch argument? That's fine Satyam. The concern in that bug was about "Remove catch clause" and "Replace catch clause with throws" quick assists which work on the whole catch clause. However, 'Move exception to separate catch block' works on the selected exception(s) hence it is reasonable to offer it as well. I will take a look. Notes to self - The catch clause for subtype should be created before the catch clause containing the super type. - Also consider the case when there is more than one subtype-supertype relationship in a multi-catch clause.