both functions have the exact same types after erasure so they conflict. JVM name must not contain
.;[/<>
(and if targeting Android, additional restrictions apply on some versions, mainly excluding whitespace from names before Android 11)
s
Stephan Schroeder
01/05/2022, 8:09 AM
Since the return-type is different, you're probably best of using two different method names, e.g.
mapToDomainFoo
and
mapToDomainBar
.
Like ephemient mentiond currently both extensions have the same jvm-bytecode representation
private static List mapToDomain(List this)
(since the JVM doesn't retain generic type info) and therefore clash.
r
Ruckus
01/05/2022, 4:00 PM
You don't need to include the package in
@JvmName
, just the function name, so
@JvmName("mapToDomainkBar")
should be what you want. I have also had issues with auto correct spewing out garbage from time to time, especially with anything related to `typealias`es.
e
ephemient
01/05/2022, 4:04 PM
if you don't have Java callers, the JVM name doesn't have to be a valid Java identifier, you could
@JvmName("map-NetworkFoo-to-DomainFoo")
and
@JvmName("map-NetworkBar-to-DomainBar")
.
c
Colton Idle
01/05/2022, 9:16 PM
Thanks for the info everyone. Learned something new.
I want to just use the JvmName annotation, but if I use
Copy code
@JvmName("asdf-mapToDomain")
it still fails with the error,
Illegal JVM name
Colton Idle
01/05/2022, 9:19 PM
I think the kotlin compiler just got stuck in some loop. Restarted the IDE and the errors went away.