GrMethodCallExpression (ExtractInfoHelper helper) { StringBuilder buffer = new StringBuilder(); appendName(buffer, helper.getName()); buffer.append("("); int number = 0; for (ParameterInfo info : helper.getParameterInfos()) { if (info.passAsParameter) number++; } int i = 0; String[] argumentNames = helper.getArgumentNames(); for (String argName : argumentNames) { if (!argName.isEmpty()) { buffer.append(argName); if (i < number - 1) { buffer.append(","); } i++; } } buffer.append(")"); String callText = buffer.toString(); GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(helper.getProject()); GrExpression expr = factory.createExpressionFromText(callText); LOG.assertTrue(expr instanceof GrMethodCallExpression, callText); return ((GrMethodCallExpression)expr); }