Colton Idle
01/05/2022, 5:10 AMprivate fun List<NetworkFoo>.mapToDomain(): List<DomainFoo> {
return this.map { //stuff }
}
and
private fun List<NetworkBar>.mapToDomain(): List<DomainBar> {
return this.map { //stuff }
}
Error
Platform declaration clash: The following declarations have the same JVM signatureI suppose the error message is helpful in giving me a hint that these two methods are identical in JVM land? If I use the auto-correct option I get
@JvmName("mapToDomaincom.network.model.NetworkBar")
but the annotation gives me an error of:
Illegal JVM name
ephemient
01/05/2022, 6:42 AM.;[/<>
(and if targeting Android, additional restrictions apply on some versions, mainly excluding whitespace from names before Android 11)Stephan Schroeder
01/05/2022, 8:09 AMmapToDomainFoo
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.Ruckus
01/05/2022, 4:00 PM@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.ephemient
01/05/2022, 4:04 PM@JvmName("map-NetworkFoo-to-DomainFoo")
and @JvmName("map-NetworkBar-to-DomainBar")
.Colton Idle
01/05/2022, 9:16 PM@JvmName("asdf-mapToDomain")
it still fails with the error,
Illegal JVM name