https://kotlinlang.org logo
Title
d

Dominaezzz

12/19/2018, 9:11 PM
I have two identical inline extension functions on
Collection<...>
. The only difference is one is on
Collection<String>
and the other is
Collection<Closeable>
. IntelliJ complains they have the same signature on JVM (because type erasure). Even though they are inline functions?
s

Shawn

12/19/2018, 9:12 PM
I asked a related question a while ago and didn’t quite get a satisfactory answer, though I suspect the culprit may be type inference ambiguity https://kotlinlang.slack.com/archives/C0922A726/p1542916167726000?thread_ts=1542916167.726000
d

Dominaezzz

12/19/2018, 9:14 PM
Hmmm, it's weird how it works on Native but not on JVM. Isn't kotlin supposed to be somewhat consistent?
i

ilya.gorbunov

12/19/2018, 9:24 PM
Inline functions are still callable from Java, so that doesn't remove limitations regarding their erased signature. You can use
@JvmName
to give one of them different name for JVM.
d

Dominaezzz

12/19/2018, 9:25 PM
Oh, okay that'll do.