On 03/19/2017 11:42 PM, Peter Levart wrote:
No problem. Here it is (against tip of jake/jdk):
http://cr.openjdk.java.net/~plevart/jdk9-jake/AccessibleObject.canAccess_caching/webrev.02/
This patch changes a little when the stacktrace requested by
sun.reflect.debugModuleAccessChecks system property is printed. In
original code it is printed when the access (invocation, get/set)
itself fails as well as when AccessibleObject.canAccess() returns
false. Is that what was intended? Patched code only prints when the
actual access attempt fails and not when canAccess() returns false. If
you want canAccess() to also print stacktrace, I can add it to
canAccess() method.
...I was wrong about that claim. Original code does exactly what the
patch does - it only prints stack trace when checkAccess is called and
never when canAccess. As slowCheckMemberAccess (which printed the
stacktrace) was renamed to slowVerifyAccess (which is used from
canAccess too), the printing/throwing had to be moved to the checkAccess
method itself to preserve the behavior.
Peter