0

我有以下代码:

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

并且 eclipse 允许减少到(没有错误):

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

但是openJdk构建失败了

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

项目合规性设置为 1.8

版本:Openjdk 1.8.0-191
Eclipse 4.10

是欧洲法院的错误吗?

4

0 回答 0