void (@NotNull GrLiteral literal) { final TypeConstraint[] constraints = GroovyExpectedTypesProvider.calculateTypeConstraints(literal); boolean isChar = false; for (TypeConstraint constraint : constraints) { if (constraint instanceof SubtypeConstraint && PsiTypes.charType().equals(TypesUtil.unboxPrimitiveTypeWrapper(constraint.getDefaultType()))) { isChar = true; } } final String text = literal.getText(); final String value = GrStringUtil.unescapeString(GrStringUtil.removeQuotes(text)); if (text.startsWith("'''") || text.startsWith("\"\"\"")) { if (HighlightingFeature.TEXT_BLOCKS.isAvailable(literal)) { builder .append("\"\"\"\n") .append(PsiLiteralUtil.escapeTextBlockCharacters(StringUtil.escapeStringCharacters(value))) .append("\"\"\""); } else { String content = StringUtil.escapeStringCharacters(value).replaceAll("\\\\n([^\"])", "\\\\n\" +\n \"$1"); builder.append('"').append(content).append('"'); } } else if (text.startsWith("'")) { if (isChar) { builder.append(text); } else { builder.append('"').append(StringUtil.escapeStringCharacters(value)).append('"'); } } else if (text.startsWith("\"")) { if (isChar) { builder.append('\'').append(StringUtil.escapeCharCharacters(value)).append('\''); } else { builder.append('"').append(StringUtil.escapeStringCharacters(value)).append('"'); } } else { builder.append(text); } }