I have an odd situation I've never run into before. At my company we have a mix of projects with most in Java but a growing number in Kotlin. So we have this existing application written in Java, and we are adding a library written in Kotlin.
The Kotlin code has a function argument that takes in a lambda expression. That lambda has this type, with the "params" argument being a map with values of "Any":
(params: Map<String,Any>) -> List<Item>
In the Java code, we implement this lambda by taking "params" and passing them to a Java function:
params -> receiverFunction(params)
However, the Java function accepts a map argument with values of "Object":
public List<Item> receiverFunction(final Map<String,Object> params)
I now get a compile error, where "params" in the Java lambda is seen as having type Map<String,capture of ?>, which cannot be passed to Map<String,Object>.
What is the recommended way to achieve this level of Java/Kotlin interoperability?