If you have access to sun.misc.Unsafe, you can use defineAnonympousClass to get the trusted lookup.
https://gist.github.com/forax/dddb80a1231320868c38bb742a3051e4 that's why defineAnonymousClass is in Unsafe. Rémi ----- Mail original ----- > De: "Jochen Theodorou" <blackd...@gmx.org> > À: "John Rose" <john.r.r...@oracle.com>, "Alan Bateman" > <alan.bate...@oracle.com> > Cc: "Rémi Forax" <fo...@univ-mlv.fr>, "jigsaw-dev" > <jigsaw-dev@openjdk.java.net> > Envoyé: Samedi 23 Juillet 2016 08:59:49 > Objet: Re: creating proxies for interfaces with default methods > On 23.07.2016 01:12, John Rose wrote: >> On May 27, 2016, at 1:16 AM, Alan Bateman <alan.bate...@oracle.com >> <mailto:alan.bate...@oracle.com>> wrote: >>> >>> I don't think it's possible to create a Lookup via support API with >>> just the PRIVATE lookup mode. It only seems to work because this code >>> seems to hack into the non-public constructor. I'm curious if you >>> invoke toString on this, with JDK 8 and with -esa, as I assume you >>> will get a similar assertion. >> >> The Lookup API does not have a "setAccessible" analog. >> Maybe it should; along the lines of Unsafe.privateLookup(Class). > > would be nice, because then I would not have to depend on a hack > > bye Jochen