On 25.05.2016 22:32, Mandy Chung wrote:
On May 25, 2016, at 1:12 PM, Jochen Theodorou <blackd...@gmx.org> wrote:
Dynamic proxies and invocation handlers won't do the job, as they do not
provide an implementation of the interface I can call the default method
on.
Is this a general limitation of j.l.r.Proxy? At first glance it doesn't
seem like you're hitting an accessibility issue due to Jigsaw.
I agree this is not related to jigsaw.
The generated proxy class does not treat default methods any different than
interface methods. The invocation handler will be the one handling it in its
intended way. As you said, you need a way to invoke the default method with
reflection for implementing such an invocation handler.
you cannot invoke the default method with reflection without
implementation of the interface
I have not found a way to call a default method with reflection. I have no instance of
the interface in the Proxy, so what am I supposed to call the method on? Java can use an
invokespecial on the interface method, but you cannot do an invokespecial with reflection
(to me knowledge). With MethodHandles you can in theory do that - it exceeds my knowledge
on what you actually call it, since there is no implementation. But then again, what if
the default method calls another method of the interface? what is "this" there?
Perhaps you can ask this at mlvm-...@openjdk.java.net
It does only partially matter, since I cannot normally get a Lookup
object, that allows me to do that. And the way I did that, does not work
anymore in JDK9. But maybe not because of jigsaw
bye Jochen