Interop question, platform declaration clash


#1

I’m trying to build something like this:

interface GraphQLError {
	fun getMessage(): String
}

class MyOwnException(s: String?) : RuntimeException(s), GraphQLError

However, I’m getting 2 errors:

Class 'MyOwnException' is not abstract and does not implement abstract member public abstract fun getMessage(): String defined in com.arcnor.test.GraphQLError
---
Inherited platform declarations clash: The following declarations have the same JVM signature (getMessage()Ljava/lang/String;): fun <get-message>(): String? defined in com.arcnor.test.MyOwnException fun getMessage(): String defined in com.arcnor.test.MyOwnException

I don’t understand why I’m getting a clash? RuntimeException already defines getMessage(): String, which should be used for this definition?

In any case, I’m really getting this error from the graphql Java library, that contains a similar definition to my GraphQLError interface there, but defined in Java, but it fails both with the original and my simple file up there.

Finally, even if I try to implement this myself (override fun getMessage()...) I get the following error:

Kotlin: Accidental override: The following declarations have the same JVM signature (getMessage()Ljava/lang/String;):
    fun <get-message>(): String? defined in com.arcnor.test.MyOwnException
    fun getMessage(): String defined in com.arcnor.test.MyOwnException

Also, it seems some other people had the same questions here (https://stackoverflow.com/questions/48698699/accidental-override-the-following-declarations-have-the-same-jvm-signature-wh) and here (https://github.com/graphql-java/graphql-java/issues/1022)


#2

I was not expecting this to be so hard to answer :slight_smile:. Should I open a ticket about that instead?