public static @Nullable PsiCaseLabelElement createPatternFromExpression(@NotNull PsiExpression expression) {
    final PsiElementFactory factory = PsiElementFactory.getInstance(expression.getProject());
    final String patternCaseText = createPatternCaseText(expression);
    if (patternCaseText == null) return null;
    final String labelText = "case " + patternCaseText + "->{}";
    final PsiStatement statement = factory.createStatementFromText(labelText, null);
    final PsiSwitchLabelStatementBase label = ObjectUtils.tryCast(statement, PsiSwitchLabelStatementBase.class);
    assert label != null;
    return Objects.requireNonNull(label.getCaseLabelElementList()).getElements()[0];
  }
public static @Nullable PsiCaseLabelElement createPatternFromExpression(@NotNull PsiExpression expression)