In the course of #34028, it turned out that the Java 9+ InaccessibleObjectException
should be equivalently caught wherever we have special treatment of IllegalAccessException
since the former is thrown from setAccessible
whereas the latter is thrown from Method.invoke
. With the Java Platform Module System, setAccessible
may fail when we try to call it on non-public classes.