creating proxies for interfaces with default methods

forax at univ-mlv.fr forax at univ-mlv.fr
Fri May 27 06:58:54 UTC 2016



----- Mail original -----
> De: "Jochen Theodorou" <blackdrag at gmx.org>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "jigsaw-dev" <jigsaw-dev at openjdk.java.net>
> Envoyé: Vendredi 27 Mai 2016 07:28:58
> Objet: Re: creating proxies for interfaces with default methods
> 
> On 26.05.2016 14:00, Remi Forax wrote:
> > Not if you use Lookup.findSpecial() [1]
> > Anyway, you can not use it because you can not get the Lookup object
> > associated with the proxy class.
> 
> which is why I did this:
> 
> >       MethodHandles.Lookup.class.getDeclaredConstructor(Class.class,
> >       int.class).
> >       newInstance(interfaceClass, MethodHandles.Lookup.PRIVATE).
> >       unreflectSpecial(method, interfaceClass).
> >       bindTo(receiver);
> 
> but that is not working anymore.

??, what's the exact error ?

> 
> > That's why i've written the Proxy2 library [2].
> >
> > so the solutions are either you use the Proxy2 library (which doesn't work
> > with jdk9 yet) or we retrofit the interface InvocationHandler to take a
> > supplementary Lookup object.
> > regards,
> > Rémi
> >
> > [1]
> > http://docs.oracle.com/javase/7/docs/api/java/lang/invoke/MethodHandles.Lookup.html#findSpecial%28java.lang.Class,%20java.lang.String,%20java.lang.invoke.MethodType,%20java.lang.Class%29
> > [2] https://github.com/forax/proxy2
> 
> what is the problem under jdk9?

Mostly the semantics of unsafe.defineAnonymousClass has changed so i have to investigate if i can workaround that :(

> 
> bye Jochen
> 
> 

cheers,
Rémi


More information about the jigsaw-dev mailing list