private static @Nullable CaseLabelCombinationProblem checkCaseLabelCombination(PsiCaseLabelElementList labelElementList) {
    PsiCaseLabelElement[] elements = labelElementList.getElements();
    PsiCaseLabelElement firstElement = elements[0];
    if (elements.length == 1) {
      if (firstElement instanceof PsiDefaultCaseLabelElement) {
        ModCommandAction fix = getFixFactory().createReplaceCaseDefaultWithDefaultFix(labelElementList);
        return new CaseLabelCombinationProblem(firstElement, "default.label.must.not.contains.case.keyword", fix);
      }
      return null;
    }
    if (elements.length == 2) {
      if (firstElement instanceof PsiDefaultCaseLabelElement &&
          elements[1] instanceof PsiExpression expr &&
          ExpressionUtils.isNullLiteral(expr)) {
        ModCommandAction fix = getFixFactory().createReverseCaseDefaultNullFixFix(labelElementList);
        return new CaseLabelCombinationProblem(firstElement, "invalid.default.and.null.order", fix);
      }
      if (firstElement instanceof PsiExpression expr &&
          ExpressionUtils.isNullLiteral(expr) &&
          elements[1] instanceof PsiDefaultCaseLabelElement) {
        return null;
      }
    }

    int defaultIndex = -1;
    int nullIndex = -1;
    int patternIndex = -1;

    for (int i = 0; i < elements.length; i++) {
      if (elements[i] instanceof PsiDefaultCaseLabelElement) {
        defaultIndex = i;
        break;
      }
      else if (elements[i] instanceof PsiExpression expr && ExpressionUtils.isNullLiteral(expr)) {
        nullIndex = i;
        break;
      }
      else if (elements[i] instanceof PsiPattern) {
        patternIndex = i;
      }
    }

    if (defaultIndex != -1) {
      return new CaseLabelCombinationProblem(elements[defaultIndex], "default.label.not.allowed.here", null);
    }
    if (nullIndex != -1) {
      return new CaseLabelCombinationProblem(elements[nullIndex], "null.label.not.allowed.here", null);
    }
    if (firstElement instanceof PsiExpression && patternIndex != -1) {
      return getPatternConstantCombinationProblem(elements[patternIndex]);
    }
    else if (firstElement instanceof PsiPattern) {
      PsiCaseLabelElement nonPattern = ContainerUtil.find(elements, e -> !(e instanceof PsiPattern));
      if (nonPattern != null) {
        return getPatternConstantCombinationProblem(nonPattern);
      }
      if (PsiUtil.isAvailable(JavaFeature.UNNAMED_PATTERNS_AND_VARIABLES, firstElement)) {
        PsiCaseLabelElement patternVarElement = ContainerUtil.find(elements, JavaPsiPatternUtil::containsNamedPatternVariable);
        if (patternVarElement != null) {
          return new CaseLabelCombinationProblem(patternVarElement, "invalid.case.label.combination.several.patterns.unnamed", null);
        }
      }
      else {
        return new CaseLabelCombinationProblem(elements[1], "invalid.case.label.combination.several.patterns", null);
      }
    }
    return null;
  }
private static @Nullable CaseLabelCombinationProblem checkCaseLabelCombination(PsiCaseLabelElementList labelElementList)