mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
suppress inspection for switch backward migration when not -> used: IDEA-204207
This commit is contained in:
+2
-1
@@ -34,6 +34,7 @@ public class EnhancedSwitchBackwardMigrationInspection extends AbstractBaseJavaL
|
||||
return new JavaElementVisitor() {
|
||||
@Override
|
||||
public void visitSwitchExpression(PsiSwitchExpression expression) {
|
||||
if (!SwitchUtils.isRuleFormatSwitch(expression)) return;
|
||||
if (findReplacer(expression) == null) return;
|
||||
String message = InspectionsBundle.message("inspection.switch.expression.backward.expression.migration.inspection.name");
|
||||
holder.registerProblem(expression.getFirstChild(), message, new ReplaceWithOldStyleSwitchFix());
|
||||
@@ -41,8 +42,8 @@ public class EnhancedSwitchBackwardMigrationInspection extends AbstractBaseJavaL
|
||||
|
||||
@Override
|
||||
public void visitSwitchStatement(PsiSwitchStatement statement) {
|
||||
if (findReplacer(statement) == null) return;
|
||||
if (!SwitchUtils.isRuleFormatSwitch(statement)) return;
|
||||
if (findReplacer(statement) == null) return;
|
||||
String message = InspectionsBundle.message("inspection.switch.expression.backward.statement.migration.inspection.name");
|
||||
holder.registerProblem(statement.getFirstChild(), message, new ReplaceWithOldStyleSwitchFix());
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with old style 'switch' statement" "false"
|
||||
import java.util.*;
|
||||
|
||||
class SwitchExpressionMigration {
|
||||
int foo(int n) {
|
||||
return switch<caret> (n) {
|
||||
case 1:
|
||||
break 1;
|
||||
default:
|
||||
break 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user