MetaClass[] parameterTypes = callParams.getParameterTypes();
MetaMethod method = (staticMethod) ? statement.getType().getBestMatchingStaticMethod(methodName, parameterTypes)
: statement.getType().getBestMatchingMethod(methodName, parameterTypes);
if (method == null) {
throw new UndefinedMethodException(statement.getType(), methodName, parameterTypes);
}
callParams = fromStatements(GenUtil.generateCallParameters(method, context, parameters));
statement = new MethodInvocation(method, callParams);