RFR: 8177086: java.lang.reflect.AccessibleObject::canAccess should share access cache with internal method ::checkAccess
mandy.chung at oracle.com
Mon Mar 20 17:50:05 UTC 2017
> On Mar 20, 2017, at 2:58 AM, Peter Levart <peter.levart at gmail.com> wrote:
> On 03/19/2017 11:42 PM, Peter Levart wrote:
>> No problem. Here it is (against tip of jake/jdk):
>> 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.
Looks like webrev.02 was updated to include what you described above. Anyway, the patch looks okay to me.
More information about the core-libs-dev