public static boolean calculateCanMergeBranches(@NotNull PsiSwitchLabelStatementBase rule) {
      PsiCaseLabelElementList labelElementList = rule.getCaseLabelElementList();
      if (labelElementList == null) return false;
      PsiCaseLabelElement[] elements = labelElementList.getElements();
      return !ContainerUtil.exists(elements,
                                   element -> element instanceof PsiPattern && (!PsiUtil.isAvailable(
                                     JavaFeature.UNNAMED_PATTERNS_AND_VARIABLES, element) ||
                                                                                JavaPsiPatternUtil.containsNamedPatternVariable(element)) ||
                                              element instanceof PsiExpression expr && ExpressionUtils.isNullLiteral(expr));
    }
public static boolean calculateCanMergeBranches(@NotNull PsiSwitchLabelStatementBase rule)