Closed
Description
Compiler version
3.0.0-RC3
Minimized code
val l = java.util.List.of(1, 2, 3)
l.forEach(x => println(x))
Output
[error] 4 | l.forEach(x => println(x))
[error] | ^
[error] |object creation impossible, since def accept(x$0: T): Unit in trait Consumer in package java.util.function is not defined
[error] |(Note that
[error] | parameter T in def accept(x$0: T): Unit in trait Consumer in package java.util.function does not match
[error] | parameter Int in final def accept(x: Int): Unit in anonymous class Object with java.util.function.Consumer[? >: Int] {...}
[error] | )
This works:
val l = java.util.List.of(1, 2, 3)
val consumer: java.util.function.Consumer[Int] = x => println(x)
l.forEach(consumer)