Type inference limitations with lambda expressions
java, java-8, lambda, type-inference
Solution
It is an eclipse bug. Both compile fine with Netbeans or javac.
It seems that Eclipse has quite a few issues with java 8...
Problem
While Java 8's type inference seems much improved, I've hit on a possible limitation and I'm not sure if there's some workaround I'm missing. The scenario: ``` class Foo<T> { <U> void apply(Function<T, Consumer<U>> bar) {} } class Bar { void setBar(String bar){} } Foo<Bar> foo = new Foo<>(); ``` This works: ``` foo.<String>apply(bar -> bar::setBar); ``` This does not: ``` foo.apply(bar -> bar::setBar); ``` Is there any way to get type inference to work in this sort of situation?