Fix important parameter not used in ReflexionUtil

This commit is contained in:
Marc Baloup 2019-07-29 22:10:43 +02:00
parent c72a1af3ba
commit 92a1d21b3b

View File

@ -96,7 +96,7 @@ public class ReflexionUtil {
} }
public static Object invokeMethod(Class<?> clazz, Object instance, String methodName, Class<?>[] parameterTypes, Object... args) throws ReflectiveOperationException { public static Object invokeMethod(Class<?> clazz, Object instance, String methodName, Class<?>[] parameterTypes, Object... args) throws ReflectiveOperationException {
Method m = clazz.getMethod(methodName); Method m = clazz.getMethod(methodName, parameterTypes);
m.setAccessible(true); m.setAccessible(true);
return m.invoke(instance, args); return m.invoke(instance, args);
} }
@ -143,7 +143,7 @@ public class ReflexionUtil {
} }
public static Object invokeDeclaredMethod(Class<?> clazz, Object instance, String methodName, Class<?>[] parameterTypes, Object... args) throws ReflectiveOperationException { public static Object invokeDeclaredMethod(Class<?> clazz, Object instance, String methodName, Class<?>[] parameterTypes, Object... args) throws ReflectiveOperationException {
Method m = clazz.getDeclaredMethod(methodName); Method m = clazz.getDeclaredMethod(methodName, parameterTypes);
m.setAccessible(true); m.setAccessible(true);
return m.invoke(instance, args); return m.invoke(instance, args);
} }