boolean (@NotNull PsiCaseLabelElement overWhom, @NotNull PsiElement who, @NotNull PsiType selectorType) { if (!JavaPsiPatternUtil.isUnconditionalForType(overWhom, selectorType) && ((!(overWhom instanceof PsiExpression expression) || ExpressionUtils.isNullLiteral(expression)) && who instanceof PsiKeyword && PsiKeyword.DEFAULT.equals(who.getText()) || isInCaseNullDefaultLabel(who))) { // JEP 440-441 // A 'default' label dominates a case label with a case pattern, // and it also dominates a case label with a null case constant. // A 'case null, default' label dominates all other switch labels. return true; } if (who instanceof PsiCaseLabelElement currentElement) { if (JavaPsiPatternUtil.isGuarded(currentElement)) return false; if (isConstantLabelElement(overWhom)) { PsiExpression constExpr = ObjectUtils.tryCast(overWhom, PsiExpression.class); assert constExpr != null; if (JavaPsiPatternUtil.dominatesOverConstant(currentElement, constExpr.getType())) { return true; } } else { if (JavaPsiPatternUtil.dominates(currentElement, overWhom)) { return true; } } } return false; }