mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
move "Identical 'catch' branches in 'try' statement" inspection to migration aids group
This commit is contained in:
@@ -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
|
||||
|
||||
+3
-3
@@ -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>
|
||||
Reference in New Issue
Block a user