boolean (@NotNull List<? extends List<PsiSwitchLabelStatementBase>> switchBlockGroup, @NotNull Set<? super PsiElement> alreadyFallThroughElements, @NotNull Consumer<? super HighlightInfo.Builder> errorSink) { if (switchBlockGroup.isEmpty()) return false; boolean reported = false; for (List<PsiSwitchLabelStatementBase> switchLabel : switchBlockGroup) { for (PsiSwitchLabelStatementBase switchLabelElement : switchLabel) { PsiCaseLabelElementList labelElementList = switchLabelElement.getCaseLabelElementList(); if (labelElementList == null || labelElementList.getElementCount() == 0) continue; CaseLabelCombinationProblem problem = checkCaseLabelCombination(labelElementList); PsiCaseLabelElement[] elements = labelElementList.getElements(); final PsiCaseLabelElement first = elements[0]; if (problem != null) { HighlightInfo.Builder info = addIllegalFallThroughError(problem.element(), problem.message(), problem.customAction(), alreadyFallThroughElements); errorSink.accept(info); reported = true; } else { if (JavaPsiPatternUtil.containsNamedPatternVariable(first)) { PsiElement nextNotLabel = PsiTreeUtil.skipSiblingsForward(switchLabelElement, PsiWhiteSpace.class, PsiComment.class, PsiSwitchLabelStatement.class); //there is no statement, it is allowed to go through (14.11.1 JEP 440-441) if (!(nextNotLabel instanceof PsiStatement)) { continue; } if (PsiTreeUtil.skipWhitespacesAndCommentsForward(switchLabelElement) instanceof PsiSwitchLabelStatement || PsiTreeUtil.skipWhitespacesAndCommentsBackward(switchLabelElement) instanceof PsiSwitchLabelStatement) { HighlightInfo.Builder info = addIllegalFallThroughError(first, "multiple.switch.labels", null, alreadyFallThroughElements); errorSink.accept(info); reported = true; } } } } } return reported; }