void (@NotNull PsiSwitchBlock switchBlock) { final PsiCodeBlock body = switchBlock.getBody(); if (body == null) { return; } final PsiStatement[] statements = body.getStatements(); for (int i = 1; i < statements.length; i++) { final PsiStatement statement = statements[i]; 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 comment) { final String commentText = comment.getText(); if (commentPattern.matcher(commentText).find() && JavaSuppressionUtil.getSuppressedInspectionIdsIn(comment) == null) { continue; } } final PsiStatement previousStatement = PsiTreeUtil.getPrevSiblingOfType(statement, PsiStatement.class); if (previousStatement instanceof PsiSwitchLabelStatement) { // don't warn if there are no regular statements after the switch label continue; } if (ControlFlowUtils.statementMayCompleteNormally(previousStatement)) { registerError(statement, switchBlock instanceof PsiSwitchStatement || isOnTheFly(), switchBlock instanceof PsiSwitchExpression ? PsiKeyword.YIELD : PsiKeyword.BREAK); } } }