| 68 | } |
| 69 | |
| 70 | public Object invoke(Object instance, Object ... arguments) |
| 71 | throws InvocationTargetException, IllegalAccessException |
| 72 | { |
| 73 | if ((vmMethod.flags & Modifier.STATIC) != 0 |
| 74 | || Class.isInstance(vmMethod.class_, instance)) |
| 75 | { |
| 76 | if ((vmMethod.flags & Modifier.STATIC) != 0) { |
| 77 | instance = null; |
| 78 | } |
| 79 | |
| 80 | if (arguments == null) { |
| 81 | if (vmMethod.parameterCount > 0) { |
| 82 | throw new NullPointerException(); |
| 83 | } |
| 84 | arguments = new Object[0]; |
| 85 | } |
| 86 | |
| 87 | if (arguments.length == vmMethod.parameterCount) { |
| 88 | Classes.initialize(vmMethod.class_); |
| 89 | |
| 90 | return invoke(vmMethod, instance, arguments); |
| 91 | } else { |
| 92 | throw new ArrayIndexOutOfBoundsException(); |
| 93 | } |
| 94 | } else { |
| 95 | // System.out.println |
| 96 | // (getDeclaringClass() + "." + getName() + " flags: " + vmMethod.flags + " vm flags: " + vmMethod.vmFlags + " return code: " + vmMethod.returnCode); |
| 97 | throw new IllegalArgumentException(); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | private static native Object invoke(VMMethod method, Object instance, |
| 102 | Object ... arguments) |