On 19/03/2017 22:47, Jochen Theodorou wrote:
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.
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?
JEP 274 added Lookup.accessClass and may be closer to what you need.