GrStatement[] (final VariableInfo[] infos, GrMethodCallExpression callExpression, final Project project) { GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(project); StringBuilder tuple = new StringBuilder(); tuple.append("def ("); for (VariableInfo info : infos) { final PsiType type = info.getType(); if (type != null) { final PsiType unboxed = TypesUtil.unboxPrimitiveTypeWrapper(type); tuple.append(unboxed.getCanonicalText()); tuple.append(' '); } tuple.append(info.getName()); tuple.append(","); } StringUtil.trimEnd(tuple, ","); tuple.append(")="); tuple.append(callExpression.getText()); return new GrStatement[]{factory.createStatementFromText(tuple)}; }