boolean (@NotNull List<? extends List<? extends PsiSwitchLabelStatementBase>> switchBlockGroup, @NotNull Set<PsiElement> alreadyFallThroughElements, @NotNull Consumer<? super HighlightInfo.Builder> errorSink) { boolean reported = false; for (int i = 1; i < switchBlockGroup.size(); i++) { List<? extends PsiSwitchLabelStatementBase> switchLabels = switchBlockGroup.get(i); PsiSwitchLabelStatementBase firstSwitchLabelInGroup = switchLabels.get(0); for (PsiSwitchLabelStatementBase switchLabel : switchLabels) { if (!(switchLabel instanceof PsiSwitchLabelStatement)) { return reported; } PsiCaseLabelElementList labelElementList = switchLabel.getCaseLabelElementList(); if (labelElementList == null) continue; List<PsiCaseLabelElement> patternElements = ContainerUtil.filter(labelElementList.getElements(), labelElement -> JavaPsiPatternUtil.containsNamedPatternVariable(labelElement)); if (patternElements.isEmpty()) continue; PsiStatement prevStatement = PsiTreeUtil.getPrevSiblingOfType(firstSwitchLabelInGroup, PsiStatement.class); if (prevStatement == null) continue; if (ControlFlowUtils.statementMayCompleteNormally(prevStatement)) { List<PsiCaseLabelElement> elements = ContainerUtil.filter(patternElements, patternElement -> !alreadyFallThroughElements.contains(patternElement)); for (PsiCaseLabelElement patternElement : elements) { errorSink.accept(createError(patternElement, JavaErrorBundle.message("switch.illegal.fall.through.to"))); reported = true; } } } } return reported; }