使用方法 notify() 实例化 Kotlin class 时出现 LinkageError

LinkageError on instantiate Kotlin class with method notify()

在 Kotlin 中,您可以在 class 中声明 notify() 方法,因为 wait/notify 不适用于 Any class。但是创建这样 class 的实例会抛出 LinkageError

class Test {
    fun notify(){}
}

//create instance throws LinkageError
Test()

应该是编译问题吧?

感谢举报,这确实应该被禁止。这是相关问题:https://youtrack.jetbrains.com/issue/KT-7174