RFR: 8177086: java.lang.reflect.AccessibleObject::canAccess should share access cache with internal method ::checkAccess
blackdrag at gmx.org
Mon Mar 20 16:33:35 UTC 2017
frankly I would migrate more from the normal reflection API to the
MethodHandles API instead of extending the Reflection API further, but I
see the use case and reasoning here. thanks.
On 20.03.2017 10:04, Alan Bateman wrote:
> On 19/03/2017 22:47, Jochen Theodorou wrote:
>> not wanting to hijack the thread, but why is there no canAccess method
>> that takes a class argument to check if that class can access? Why
>> always depending so much on caller sensitive methods?
> This method is intended to be used in conjunction with
> Constructor.newInstance, Method.invoke, Field.get, ... The idiom in
> Peter's mail combines this with trySetAccessible and makes it easy to
> gracefully handle cases where access is not allowed.
> JEP 274 added Lookup.accessClass and may be closer to what you need.
More information about the jigsaw-dev