creating proxies for interfaces with default methods
forax at univ-mlv.fr
forax at univ-mlv.fr
Sun Jul 24 17:50:11 UTC 2016
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" <blackdrag at gmx.org>
> À: "John Rose" <john.r.rose at oracle.com>, "Alan Bateman" <Alan.Bateman at oracle.com>
> Cc: "Rémi Forax" <forax at univ-mlv.fr>, "jigsaw-dev" <jigsaw-dev at 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.Bateman at oracle.com
>> <mailto:Alan.Bateman at 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
More information about the jigsaw-dev
mailing list