https://kotlinlang.org logo
Title
c

crummy

05/06/2019, 11:11 PM
I'm getting a platform declaration clash:
val Map<UInt, UInt>.hex: String
    get() = this.map { "${it.key.hex}=${it.value.hex}" }.toString()

@get:JvmName("mapIntByteHex")
val Map<UInt, UByte>.hex: String
    get() = this.map { "${it.key.hex}=${it.value.hex}" }.toString()
I added the
@JvmName
annotation to fix the error in the IDE. However, when I try to build I still get an error:
Error:(1, 1) Kotlin: Platform declaration clash: The following declarations have the same JVM signature (hex$annotations(Ljava/util/Map;)V):
    val Map<UInt, UByte>.hex: String...
    val Map<UInt, UInt>.hex: String...
Is there a way around this without changing the property names?
k

karelpeeters

05/07/2019, 9:29 AM
Works fine for me, are you sure the JVM is your only platform?
i

ilya.gorbunov

05/07/2019, 6:18 PM
The issue can be in the annotations of these properties omitted from the example. I've reproduced and filed the issue here: https://youtrack.jetbrains.com/issue/KT-31352
k

karelpeeters

05/07/2019, 8:24 PM
Interesting, why does
hex$annotations
exist?
c

crummy

05/07/2019, 11:34 PM
Thanks Ilya! I ended up deciding my annotations were really better off as functions extensions than property extensions and that solved the issue