String (GrExpression expr) { if (PsiUtil.isThisOrSuperRef(expr)) return expr.getText(); String text = expr.getText(); final PsiType type = expr.getType(); if (type != null && CommonClassNames.JAVA_LANG_STRING.equals(type.getCanonicalText())) { if (expr instanceof GrBinaryExpression && GroovyTokenTypes.mPLUS.equals(((GrBinaryExpression)expr).getOperationTokenType())) { return '(' + text + ')'; } else { return text; } } else { return "String.valueOf(" + text + ")"; } }