I have two identical inline extension functions on...
# intellij
d
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. Even though they are inline functions?
s
This is maybe more of a question for #general since this is actually working as intended, I’m pretty sure
d
Ah, wasn't sure.
r
Yep, compiler still generates these functions in bytecode, even ones with reified types, so name clash is still an issue to deal with.
😞 1
d
It compiles on Nati..... Ah byte code.
r
Unfortunately Kotlin has to deal with platform limitations, which are different on different platforms. This is one of them. Gladly this is fixed by single annotation per method, which is better than nothing.
d
How to use annotation?
r
You should be able to use `@JvmName`:
Copy code
@JvmName("doWorkOnStrings")
fun Collection<String>.doWork()
@JvmName("doWorkOnCloseables")
fun Collection<Closeable>.doWork()
d
Thanks!
r
Then in bytecode (and for Java side) these functions would have different names, so clash isn't there.
No problem!