String (@NotNull UStringConcatenationsFacade cf, @NotNull List<? super UExpression> formatParameters, @NotNull Project project, boolean nested) { StringBuilder result = new StringBuilder(); boolean noEscapingRequired = !nested && SequencesKt.all(cf.getUastOperands(), expression -> expression instanceof ULiteralExpression); for (UExpression expression : SequencesKt.asIterable(cf.getUastOperands())) { while (expression instanceof UParenthesizedExpression) { expression = ((UParenthesizedExpression)expression).getExpression(); } if (expression instanceof ULiteralExpression) { Object value = ((ULiteralExpression)expression).getValue(); if (value != null) { if (noEscapingRequired) { result.append(value); } else { String formatString = PsiConcatenationUtil.formatString(value.toString(), false); result.append(nested ? PsiConcatenationUtil.formatString(formatString, false) : formatString); } } } else if (nested || !addChoicePattern(expression, formatParameters, project, result)) { result.append("{").append(formatParameters.size()).append("}"); formatParameters.add(expression); } } return result.toString(); }