:sad-panda: Can't have these two signatures in t...
# getting-started
d
sad panda Can't have these two signatures in the same interface, despite being able to in a class.
Copy code
class A
class B

interface Broken {
    //  @JvmName("runA") // annotation is not applicable to this declaration.
    fun run(collection: Collection<A>)
    fun run(collection: Collection<B>)  // Platform declaration clash: The following declarations have the same JVM signature
}
y
You can just suppress the
@JvmName
error. Sadly I don't know of a better fix
Oh, you could have one of the methods take an extra
unit: Unit = Unit
parameter
d
Didn’t know you could suppress errors.
Hmm, that might work. Still hacky though.
c
You can just suppress the
@JvmName
error. Sadly I don't know of a better fix
IIRC that's dangerous because the annotation isn't inherited, so you have to manually put it in all implementations. It makes it easy to forget overrides
1
d
> Didn’t know you could suppress errors. Please don't. There are no guarantees for the compiler behavior if you suppress an error
d
lol. I know. I just ended up renaming one of the methods to avoid this. It’s unfortunate that it’s necessary, but it is.