move "Identical 'catch' branches in 'try' statement" inspection to migration aids group

This commit is contained in:
Bas Leijdekkers
2011-02-22 17:08:41 +01:00
parent 20812d36f8
commit bbd0b72f38
3 changed files with 5 additions and 4 deletions
@@ -1855,3 +1855,4 @@ if.can.be.switch.int.option=Suggest switch on int
if.can.be.switch.enum.option=Suggest switch on enum
unnecessarily.qualified.inner.class.access.option=Ignore references to foreign inner classes
unqualified.inner.class.access.option=Ignore references to local inner classes
try.with.identical.catches.quickfix=Collapse catch blocks into multi-catch
@@ -30,6 +30,7 @@ import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
import com.siyeh.ig.InspectionGadgetsFix;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
@@ -123,16 +124,15 @@ public class TryWithIdenticalCatchesInspection extends BaseInspection {
if (parameter1 == null || parameter2 == null) {
return;
}
String text = "try { } catch(" + parameter1.getTypeElement().getText() + " | " + parameter2.getTypeElement().getText() + " e) { }";
@NonNls String text = "try { } catch(" + parameter1.getTypeElement().getText() + " | " + parameter2.getTypeElement().getText() + " e) { }";
PsiTryStatement newTryCatch = (PsiTryStatement)JavaPsiFacade.getElementFactory(project).createStatementFromText(text, stmt);
parameter1.getTypeElement().replace(newTryCatch.getCatchSections() [0].getParameter().getTypeElement());
section.delete();
}
@NotNull
@Override
public String getName() {
return"Collapse catch blocks into multi-catch";
return InspectionGadgetsBundle.message("try.with.identical.catches.quickfix");
}
}
}
@@ -2,6 +2,6 @@
<body>
This inspection reports identical 'catch' sections in 'try' blocks under JDK 7. A quickfix is provided to collapse the sections into
a multi-catch section.
<small>Powered by InspectionGadgets</small>
<p><small>Powered by InspectionGadgets</small>
</body>
</html>