Delegates to java defaults methods in compatibility mode

This commit is contained in:
Mikhael Bogdanov
2017-01-25 17:32:44 +01:00
parent 0006a04b01
commit 25d75bcd8b
6 changed files with 44 additions and 8 deletions

View File

@@ -0,0 +1,22 @@
// LANGUAGE_VERSION: 1.0
// FILE: Base.java
public interface Base {
String getValue();
default String test() {
return getValue();
}
}
// FILE: main.kt
class OK : Base {
override fun getValue() = "OK"
}
fun box(): String {
val z = object : Base by OK() {
override fun getValue() = "Fail"
}
return z.test()
}