mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
Delegates to java defaults methods in compatibility mode
This commit is contained in:
22
compiler/testData/codegen/java8/box/delegationBy/simple1.0.kt
vendored
Normal file
22
compiler/testData/codegen/java8/box/delegationBy/simple1.0.kt
vendored
Normal 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()
|
||||
}
|
||||
Reference in New Issue
Block a user