"foo"异常为什么没有被抛出,但是后续调用invoke()时会抛出下面的异常?
if (method.getDeclaringClass() != object.getClass())
throw new RuntimeException("foo");
method.invoke(object);
抛出异常:
java.lang.IllegalArgumentException: 对象不是声明类的实例
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)