Suggestion: allow accessible reflection on protected methods of exported types.

Andrew Dinn adinn at
Tue Jan 10 14:40:36 UTC 2017

On 10/01/17 13:51, Jochen Theodorou wrote:
  . . .
> I guess the trick is that I am using reflection to get a Lookup object
> that has full priviledges... a trick that does no longer work in current
> jigsaw

You /can/ use this trick if you have an agent. I do so in my latest
Byteman prototype (not yet released) which relies on MethodHandles
instead of reflection when running on JDK9.

That's possible because an agent can use its Instrumentation instance to
'export open' the MethodHandles package to a module of its own making
and then create the Lookup from within that module.

Obviously this is not a 'legitimate' way to create a Lookup -- hijacking
an internal API is never safe (irrespective of how unlikely it is that
the API might change or disappear). John Rose has raised an issue to
look into providing a /legitimate/ way of making Lookups available to
interested 3rd parties:

If you have any input to provide as to how this might be done without
(as John says) 'giving away the store' I am sure it would be listened to
with interest.


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander

More information about the jigsaw-dev mailing list