String (GrLiteral literal) { PsiElement child = literal.getFirstChild(); if (child == null) return literal.getText(); String text; ArrayList<String> list = new ArrayList<>(); PsiElement prevSibling = null; PsiElement nextSibling; do { text = child.getText(); nextSibling = child.getNextSibling(); if (child instanceof GrStringInjection) { if (((GrStringInjection)child).getClosableBlock() != null) { text = prepareClosableBlock(((GrStringInjection)child).getClosableBlock()); } else if (((GrStringInjection)child).getExpression() != null) { text = prepareExpression(((GrStringInjection)child).getExpression()); } else { text = child.getText(); } } else { text = prepareText(text, prevSibling == null, nextSibling == null, nextSibling instanceof GrClosableBlock || nextSibling instanceof GrReferenceExpression); } if (text != null) { list.add(text); } prevSibling = child; child = child.getNextSibling(); } while (child != null); StringBuilder builder = new StringBuilder(literal.getTextLength() * 2); if (list.isEmpty()) return "''"; builder.append(list.get(0)); for (int i = 1; i < list.size(); i++) { builder.append(" + ").append(list.get(i)); } return builder.toString(); }