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:
Dmitry Petrov
2015-10-08 13:00:13 +03:00
parent 5d9ee7efee
commit 7e9e427d4c
36 changed files with 247 additions and 190 deletions
+7 -4
View File
@@ -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()