invoking a interface default method from within an InvocationHandler
Jochen Theodorou
blackdrag at gmx.org
Thu Oct 9 15:22:26 UTC 2014
Am 09.10.2014 17:02, schrieb Alessio Stalla:
> "All problems in computer science can be solved by another level of
> indirection"... "except for the problem of too many layers of indirection".
>
> What about (untested):
>
> Consumer proxy = Proxy.newProxyInstance(...);
> Consumer myConsumer = proxy::accept;
>
> If you keep the proxy inaccessible, nobody will ever call andThen on it.
I wonder if I find this genius or just ill, lol.
Have not tested it yet, but I guess it would solve the problem for
functional interfaces.... what about an interface with 3 methods, of
which only one is a default one? A InvocationHandler can handle more
than one method, lambda conversion cannot.
bye Jochen
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org
More information about the mlvm-dev
mailing list