3 ms·
> Default methods cannot be accessed from within lambda expressions. Why is that?
by konne88 11y ago
> Default methods cannot be accessed from within lambda expressions.
Why is that?
- ygra 11y agoIf I had to guess, it's because the lambda will be expanded at runtime to an anonymous interface implementation. Then either the runtime part is the problem or maybe they use a different, but compatible functional interface for the ad-hoc implementation, which then has no access to default methods on the one you're assigning to.
- pjmlp 11y agoThat is not how lambdas work actually work in the reference JVM. They make use of invokedynamic, there is no expansion taking place as many think. http://www.infoq.com/articles/Java-8-Lambdas-A-Peek-Under-the-Hood http://www.infoq.com/articles/Java-8-Lambdas-A-Peek-Under-th...