SAM type inference if multiple method overloads accept a fitting SAM type

I’m having an issue understanding why something works in Java, but not in Kotlin.

I have two SAM Interfaces (SerializiableFunction, ProcessFunction).

I have two method overloads that accept these SAMs on the same class, e.g.:

public static void function(SerializableFunction<String, String> sf) {}
public static void function(ProcessFunction<String, String> pf) {}

In Java, i can do function(s → s) without issues, but in Kotlin it complains:

Error:(31, 14) Kotlin: Cannot choose among the following candidates without completing type inference

Why does this work in Java? Both method overloads would apply here, so it ought to either not work or work in both, right?

This looks like a bug in Kotlin type inference. Can you please report an issue at http://kotl.in/issue with a self-contained sample project to reproduce? Thanks!

Note: I tried searching https://youtrack.jetbrains.com/issues?q=Subtask%20of:%20KT-4066%20%23Unresolved%20 but doesn’t look like this particular problem has been reported yet.