return VM_Reflection.invoke(method, receiver, args); } catch (Throwable e) { e.printStackTrace( System.err ); throw new InvocationTargetException(e);
args[i] = makeArgumentCompatible(parameterTypes[i].resolve(), args[i]); } catch (ClassNotFoundException e) { if (VM.VerifyAssertions) VM._assert(false);
    public static Object invoke(Method m, Object receiver, Object args[])    throws IllegalAccessException, 	   IllegalArgumentException, 	   InvocationTargetException {      VM_Method method = java.lang.reflect.JikesRVMSupport.getMethodOf(m);      VM_TypeReference[] parameterTypes = method.getParameterTypes();      // validate "this" argument      //      if (!method.isStatic()) {        if (receiver == null)          throw new NullPointerException();        if (!argumentIsCompatible(method.getDeclaringClass(), receiver))          throw new IllegalArgumentException("type mismatch on \"this\" argument");      }      // validate number and types of remaining arguments      // !!TODO: deal with widening/narrowing conversions on primitives      //      if (args == null) {        if (parameterTypes.length != 0)          throw new IllegalArgumentException("argument count mismatch");      } else if (args.length != parameterTypes.length)        throw new IllegalArgumentException("argument count mismatch");      for (int i = 0, n = parameterTypes.length; i < n; ++i) {	try {	  if (!argumentIsCompatible(parameterTypes[i].resolve(), args[i]))	    throw new IllegalArgumentException("type mismatch on argument " + i);	} catch (ClassNotFoundException e) {	  if (VM.VerifyAssertions) VM._assert(false); // Should never happen?	}      }      // invoke method      // Note that we catch all possible exceptions, not just Error's and RuntimeException's,      // for compatibility with jdk behavior (which even catches a "throw new Throwable()").      //      try {        return VM_Reflection.invoke(method, receiver, args);      } catch (Throwable e) {	e.printStackTrace( System.err );        throw new InvocationTargetException(e);      }    }