GrClosableBlock (@NotNull GrIntroduceParameterSettings helper) { StringBuilder buffer = new StringBuilder(); buffer.append("{ "); final String[] params = ExtractUtil.getParameterString(helper, true); if (params.length > 0) { for (String p : params) { buffer.append(p); } buffer.append("->"); } if (helper.getStatements().length > 1) { buffer.append('\n'); } ExtractUtil.generateBody(helper, false, buffer, helper.isForceReturn()); buffer.append(" }"); return GroovyPsiElementFactory.getInstance(helper.getProject()).createClosureFromText(buffer.toString(), helper.getToReplaceIn()); }