Initial support of @JvmDefault

This commit is contained in:
Mikhael Bogdanov
2018-02-20 18:02:54 +01:00
parent e885195ee1
commit fe45eb2a81
50 changed files with 322 additions and 256 deletions
@@ -0,0 +1,21 @@
// !API_VERSION: 1.3
// JVM_TARGET: 1.8
// WITH_RUNTIME
// FILE: 1.kt
interface Test {
@kotlin.annotations.JvmDefault
fun test(): String {
return "OK"
}
}
// FILE: 2.kt
class TestClass : Test {
override fun test(): String {
return super.test()
}
}
fun box(): String {
return TestClass().test()
}
@@ -0,0 +1,23 @@
// !API_VERSION: 1.3
// JVM_TARGET: 1.8
// WITH_RUNTIME
// FILE: 1.kt
interface Test {
@kotlin.annotations.JvmDefault
fun test(): String {
return "OK"
}
}
// FILE: 2.kt
interface Test2 : Test {
@kotlin.annotations.JvmDefault
override fun test(): String {
return super.test()
}
}
fun box(): String {
return object : Test2 {}.test()
}
@@ -0,0 +1,19 @@
// !API_VERSION: 1.3
// JVM_TARGET: 1.8
// WITH_RUNTIME
// FILE: 1.kt
interface Test {
@kotlin.annotations.JvmDefault
val prop: String
get() = "OK"
}
// FILE: 2.kt
class TestClass : Test {
override val prop: String
get() = super.prop
}
fun box(): String {
return TestClass().prop
}
@@ -0,0 +1,20 @@
// !API_VERSION: 1.3
// JVM_TARGET: 1.8
// WITH_RUNTIME
// FILE: 1.kt
interface Test {
@kotlin.annotations.JvmDefault
val prop: String
get() = "OK"
}
// FILE: 2.kt
interface Test2 : Test {
@kotlin.annotations.JvmDefault
override val prop: String
get() = super.prop
}
fun box(): String {
return object : Test2 {}.prop
}