Kotlin / kotlin-koans

Kotlin workshop
MIT License
2.6k stars 1.41k forks source link

NotImplementedException class override message field in Exception class #3

Closed MaXal closed 10 years ago

MaXal commented 10 years ago
Error:(6, 31) Kotlin: Accidental override: The following declarations have the same JVM signature (getMessage()Ljava/lang/String;):
    fun <get-message>(): kotlin.String
    fun getMessage(): kotlin.String?
pcmarks commented 10 years ago

I just got this exact error message when I went to run the first unit test of the Kotlin Koans. Using IntelliJ IDEA 13.1.3

MaXal commented 10 years ago

To fix this you need to change field in NotImplementedException to something like:

class NotImplementedException(val message1: String): Exception(message1)
pcmarks commented 10 years ago

Thank you for the reply. I made the change you suggested and the unit test now compiles and runs.

Should this change be made in the github repository or am I using some combination of tools and libraries that causes the error to occur?

Thanks again.

MaXal commented 10 years ago

Yes, I believe this change should be in the repository and it's not connected to environment.

svtk commented 10 years ago

I've updated the code. The problem occurred because we started to report platform signature clashes (http://blog.jetbrains.com/kotlin/2014/07/m8-is-out/).