Error - cannot infer type-variable(s) K,V - OpenJDK 1.8 vs ECJ 1.8 difference with lambdas?

93 views Asked by At

I have following code:

Type a;
List<Pair<Consumer<LocalDate>, LocalDate>> list = new LinkedList<>();
a.getListB().stream().forEach((TypeB b) -> { 
   list.add(new Pair<>(b::setDate, b.getDate()));
  });

And eclipse allows reduction to (no error):

Type a;
List<Pair<Consumer<LocalDate>, LocalDate>> list = new LinkedList<>();
a.getListB().stream().forEach(b -> list.add(new Pair<>(b::setDate, b.getDate())));

But openJdk build fails on

[ERROR]     reason: cannot infer type-variable(s) K,V
[ERROR]       (argument mismatch; java.lang.Object is not a functional interface)

Project compliance is set to 1.8

versions: Openjdk 1.8.0-191
Eclipse 4.10

Is it ECJ bug?

0

There are 0 answers