From 60873c69a5927857b2b877cb648af1fbc60e7a34 Mon Sep 17 00:00:00 2001 From: "Anna.Kozlova" Date: Fri, 30 Nov 2018 15:11:26 +0100 Subject: [PATCH] disable fall through inspection for switch statements with old and new syntax IDEA-CR-40565 --- .../ig/controlflow/FallthruInSwitchStatementInspection.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/FallthruInSwitchStatementInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/FallthruInSwitchStatementInspection.java index b8cf63bfdd08..997aa040f9db 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/FallthruInSwitchStatementInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/FallthruInSwitchStatementInspection.java @@ -97,6 +97,10 @@ public class FallthruInSwitchStatementInspection extends BaseInspection { if (!(statement instanceof PsiSwitchLabelStatement)) { continue; } + //enhanced switch statements forbid fallthrough implicitly + if (statement instanceof PsiSwitchLabeledRuleStatement) { + return; + } final PsiElement previousSibling = PsiTreeUtil.skipWhitespacesBackward(statement); if (previousSibling instanceof PsiComment) { final PsiComment comment = (PsiComment)previousSibling;