Java 8 rules for method overrides:
- report errors on implementing methods of Any in interfaces - update testData ~~~ Java 8 override restrictions: interface can't implement a method of 'Any' - update compiler sources
This commit is contained in:
+7
-4
@@ -1,12 +1,15 @@
|
||||
interface Trait {
|
||||
fun foo() = "O"
|
||||
override fun toString() = "K"
|
||||
fun bar(): String
|
||||
}
|
||||
|
||||
class SimpleClass : Trait
|
||||
class SimpleClass : Trait {
|
||||
override fun bar() = "K"
|
||||
}
|
||||
|
||||
// Delegating 'toString' doesn't work, see KT-9519
|
||||
class ComplexClass : Trait by SimpleClass() {
|
||||
override fun toString() = foo() + super.toString()
|
||||
fun qux() = foo() + bar()
|
||||
}
|
||||
|
||||
fun box() = ComplexClass().toString()
|
||||
fun box() = ComplexClass().qux()
|
||||
|
||||
Reference in New Issue
Block a user