On Thu, Oct 9, 2014 at 5:22 PM, Jochen Theodorou <blackd...@gmx.org> wrote:
> 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. Well, you can extend this technique by using more method references and delegation (yes, even more levels of indirection!), but frankly if you could have doubts about the solution with a functional interface, this one would triumphantly jump over the line between "nice hack" and "horrible, horrible code".
_______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev