private static String calculateReplacementText(@NotNull PsiMethodCallExpression call, PsiExpression expression, boolean withEmptyString) {
    if (withEmptyString) {
      String text = ParenthesesUtils.getText(expression, ParenthesesUtils.ADDITIVE_PRECEDENCE);
      text = "\"\" + " + text;
      return text;
    }

    if (!(expression instanceof PsiPolyadicExpression)) {
      return expression.getText();
    }
    PsiPolyadicExpression parentCall = ObjectUtils.tryCast(ParenthesesUtils.getParentSkipParentheses(call), PsiPolyadicExpression.class);
    if (parentCall == null) {
      return expression.getText();
    }
    final PsiType type = expression.getType();
    int precedence = ParenthesesUtils.getPrecedence(expression);
    if (TypeUtils.typeEquals(JAVA_LANG_STRING, type) || precedence < ParenthesesUtils.ADDITIVE_PRECEDENCE ||
        (precedence == ParenthesesUtils.ADDITIVE_PRECEDENCE && ArrayUtil.getFirstElement(parentCall.getOperands()) == call)) {
      return expression.getText();
    }
    return '(' + expression.getText() + ')';
  }
private static String calculateReplacementText(@NotNull PsiMethodCallExpression call, PsiExpression expression, boolean withEmptyString)