1.1 --- a/rt/emul/mini/src/main/java/java/lang/reflect/Method.java Thu Feb 28 13:00:24 2013 +0100
1.2 +++ b/rt/emul/mini/src/main/java/java/lang/reflect/Method.java Sun Apr 07 15:24:45 2013 +0200
1.3 @@ -501,8 +501,8 @@
1.4 throws IllegalAccessException, IllegalArgumentException,
1.5 InvocationTargetException
1.6 {
1.7 - final boolean isStatic = (getModifiers() & Modifier.STATIC) == 0;
1.8 - if (isStatic && obj == null) {
1.9 + final boolean nonStatic = (getModifiers() & Modifier.STATIC) == 0;
1.10 + if (nonStatic && obj == null) {
1.11 throw new NullPointerException();
1.12 }
1.13 Class[] types = getParameterTypes();
1.14 @@ -517,7 +517,7 @@
1.15 }
1.16 }
1.17 }
1.18 - Object res = invoke0(isStatic, this, obj, args);
1.19 + Object res = invokeTry(nonStatic, this, obj, args);
1.20 if (getReturnType().isPrimitive()) {
1.21 res = fromPrimitive(getReturnType(), res);
1.22 }
1.23 @@ -536,6 +536,15 @@
1.24 + "return method._data().apply(self, p);\n"
1.25 )
1.26 private static native Object invoke0(boolean isStatic, Method m, Object self, Object[] args);
1.27 +
1.28 + private static Object invokeTry(boolean isStatic, Method m, Object self, Object[] args)
1.29 + throws InvocationTargetException {
1.30 + try {
1.31 + return invoke0(isStatic, m, self, args);
1.32 + } catch (Throwable ex) {
1.33 + throw new InvocationTargetException(ex, ex.getMessage());
1.34 + }
1.35 + }
1.36
1.37 static Object fromPrimitive(Class<?> type, Object o) {
1.38 if (type == Integer.TYPE) {