Why do I get ```Platform declaration clash: The fo...
# getting-started
t
Why do I get
Copy code
Platform declaration clash: The following declarations have the same JVM signature (invoke(Ljava/util/List;)V):
for this:
Copy code
operator fun invoke(list: List<MyObject>) = this.invoke(listOf(list))
operator fun invoke(listOfList: List<List<MyObject>>)
?
g
Because in Java both functions will be represented as
fun invoke(list: List<*>)
, because in Java generics are erased in compile-time.
t
I see, is there any workaround for my case?
g
You can rename the functions in Java world by annotating them with
@JvmName("<new function name here>")
.
In Kotlin they'll have the same names.
t
This seems to solve it, thanks Gleb!