private static boolean canBePatternSwitchCase(@Nullable PsiExpression expression,
                                                @NotNull PsiExpression switchExpression,
                                                @NotNull Set<Object> existingCaseValues) {
    if (canBePatternSwitchCase(expression, switchExpression)) {
      final PsiCaseLabelElement pattern = createPatternFromExpression(expression);
      if (pattern == null) return true;
      for (Object caseValue : existingCaseValues) {
        if (caseValue instanceof PsiPattern && JavaPsiPatternUtil.dominates((PsiPattern)caseValue, pattern)) {
          return false;
        }
      }
      existingCaseValues.add(pattern);
      return true;
    }
    else {
      return false;
    }
  }
private static boolean canBePatternSwitchCase(@Nullable PsiExpression expression,
                                                @NotNull PsiExpression switchExpression,
                                                @NotNull Set<Object> existingCaseValues)