From bbd0b72f3849cc1c08a9fc903f2b4d11a2edd9a2 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 22 Feb 2011 17:08:41 +0100 Subject: [PATCH] move "Identical 'catch' branches in 'try' statement" inspection to migration aids group --- .../src/com/siyeh/InspectionGadgetsBundle.properties | 1 + .../ig/errorhandling/TryWithIdenticalCatchesInspection.java | 6 +++--- .../src/inspectionDescriptions/TryWithIdenticalCatches.html | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties index bde874a76fa1..452fcd5e459c 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties +++ b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties @@ -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 diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/TryWithIdenticalCatchesInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/TryWithIdenticalCatchesInspection.java index bfe4f41616b5..574eb4d1320e 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/TryWithIdenticalCatchesInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/TryWithIdenticalCatchesInspection.java @@ -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"); } } } diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/TryWithIdenticalCatches.html b/plugins/InspectionGadgets/src/inspectionDescriptions/TryWithIdenticalCatches.html index 887abc484396..85514604f59d 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/TryWithIdenticalCatches.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/TryWithIdenticalCatches.html @@ -2,6 +2,6 @@ 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. -Powered by InspectionGadgets +

Powered by InspectionGadgets \ No newline at end of file