I don't see the issue if the lookup object represent the proxy class itself restricted to only access to public methods.
Rémi ----- Mail original ----- > De: "Peter Levart" <peter.lev...@gmail.com> > À: "Da Vinci Machine Project" <email@example.com>, "jochen Theodorou" > <blackd...@gmx.org> > Envoyé: Vendredi 27 Mai 2016 12:50:34 > Objet: Re: proxy an interface and call a default method > > Hi, > > I think the main problem here is that by providing the InvocationHandler > with a Lookup that could provide "invokespecial" MHs for the proxy > interface(s) could be abused. Anyone can create a Proxy for any public > interface and supply its own InvocationHandler which could be used to > "steal" such Lookup object. > > There would have to be a way to restrict calling interface "super" > methods from InvocationHandler *INSTANCES* that are bound to particular > Proxy instances. > > Hm... > > Regards, Peter > > On 05/26/2016 08:20 AM, Jochen Theodorou wrote: > > Hi all, > > > > I am looking for a solution to the following problem... I have an > > interface and an object that is supposed to serve as implementation, > > but does not implement the interface. n methods of the interface will > > be redirected to the object, but in case of default methods I would > > like to have the implementation provided by the interface. I am > > looking especially for a solution without me generating classes at > > runtime by hand. > > > > Now there are several problems... I seem not to be able to invoke a > > default method by reflection. By MethodHandles I did something like this: > > > >> MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, > >> int.class). > >> newInstance(interfaceClass, MethodHandles.Lookup.PRIVATE). > >> unreflectSpecial(method, interfaceClass). > >> bindTo(receiver); > > > > where receiver is a dynamic proxy, method the Method of the default > > method, interfaceClass the Class of the interface with the default > > method. > > > > But I am calling a private constructor here, which is bad, plus the > > above procedure does no longer work on JDK9. > > > > So what am I supposed to do? change from a proxy to runtime generated > > classes and hope the best for classloaders and modules not getting in > > my way? > > > > bye Jochen > > _______________________________________________ > > mlvm-dev mailing list > > firstname.lastname@example.org > > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > _______________________________________________ > mlvm-dev mailing list > email@example.com > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > _______________________________________________ mlvm-dev mailing list firstname.lastname@example.org http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev