void (@NotNull PsiIfStatement statement) { super.visitIfStatement(statement); final PsiElement parent = statement.getParent(); if (parent instanceof PsiIfStatement) { return; } final PsiExpression condition = statement.getCondition(); final LanguageLevel languageLevel = PsiUtil.getLanguageLevel(statement); final PsiExpression switchExpression = SwitchUtils.getSwitchSelectorExpression(condition); if (switchExpression == null) { return; } boolean isPatternMatch = SwitchUtils.canBePatternSwitchCase(condition, switchExpression); int branchCount = 0; final Set<Object> switchCaseValues = new HashSet<>(); PsiIfStatement branch = statement; while (true) { branchCount++; if (!SwitchUtils.canBeSwitchCase(branch.getCondition(), switchExpression, languageLevel, switchCaseValues, isPatternMatch)) { return; } final PsiStatement elseBranch = branch.getElseBranch(); if (!(elseBranch instanceof PsiIfStatement)) { break; } branch = (PsiIfStatement)elseBranch; } final ProblemHighlightType highlightType; if (shouldHighlight(statement, switchExpression) && branchCount >= minimumBranches) { highlightType = ProblemHighlightType.GENERIC_ERROR_OR_WARNING; } else { if (!isOnTheFly()) return; highlightType = ProblemHighlightType.INFORMATION; } registerError(statement.getFirstChild(), highlightType); }