I wrote an implicit conversion from Scala functions to Java functions:
import java.util.function.{Function => JavaFunction}
implicit def toJavaFunction[T, V](f: (T) => V): JavaFunction[T, V] = {
new JavaFunction[T, V] {
override def apply(input: T) = f(input)
}
}
However, IntelliJ suggests converting this to a single abstract method:
implicit def toJavaFunction[T, V](f: (T) => V): JavaFunction[T, V] = {
(input: T) => f(input)
}
When I change to the second implementation, functions wrapped in this method run forever and execution never terminates. What's different about the second method that's causing it to behave this way? Is there something that IntelliJ is missing?