private static void turnExpressionIntoChainedAppends(PsiExpression expression,
                                                       @NonNls StringBuilder result,
                                                       CommentTracker commentTracker) {
    if (expression instanceof PsiPolyadicExpression concatenation) {
      final PsiType type = concatenation.getType();
      if (type != null && !type.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
        result.append(".append(").append(commentTracker.text(concatenation)).append(')');
        return;
      }
      final PsiExpression[] operands = concatenation.getOperands();
      final PsiType startType = operands[0].getType();
      if (startType == null || startType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
        for (PsiExpression operand : operands) {
          turnExpressionIntoChainedAppends(operand, result, commentTracker);
        }
        return;
      }
      final StringBuilder newExpressionText = new StringBuilder(operands[0].getText());
      boolean string = false;
      for (int i = 1; i < operands.length; i++) {
        final PsiExpression operand = operands[i];
        if (!string) {
          final PsiType operandType = operand.getType();
          if (operandType == null || operandType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
            final PsiElementFactory factory = JavaPsiFacade.getElementFactory(expression.getProject());
            final PsiExpression newExpression = factory.createExpressionFromText(newExpressionText.toString(), expression);
            turnExpressionIntoChainedAppends(newExpression, result, commentTracker);
            turnExpressionIntoChainedAppends(operand, result, commentTracker);
            string = true;
          }
          newExpressionText.append('+').append(commentTracker.text(operand));
        }
        else {
          turnExpressionIntoChainedAppends(operand, result, commentTracker);
        }
      }
    }
    else {
      final PsiExpression strippedExpression = PsiUtil.skipParenthesizedExprDown(expression);
      result.append(".append(");
      if (strippedExpression != null) {
        result.append(commentTracker.text(strippedExpression));
      }
      result.append(')');
    }
  }
private static void turnExpressionIntoChainedAppends(PsiExpression expression,
                                                       @NonNls StringBuilder result,
                                                       CommentTracker commentTracker)