JvmDefaultWithoutCompatibility. Add test with Kotlin Java mixed inheritance
This commit is contained in:
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
// !JVM_DEFAULT_MODE: all
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// CHECK_BYTECODE_LISTING
|
||||
|
||||
// FILE: KBase.kt
|
||||
public interface KBase {
|
||||
public fun test(): String = "Fail"
|
||||
}
|
||||
|
||||
|
||||
// FILE: JDerived.java
|
||||
public interface JDerived extends KBase {
|
||||
public default String test() {
|
||||
return "O";
|
||||
}
|
||||
|
||||
public default String test2() {
|
||||
return "fail";
|
||||
}
|
||||
|
||||
public default String test3() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: JClass.java
|
||||
public class JClass implements KDerived {
|
||||
|
||||
public String test2() {
|
||||
return KDerived.DefaultImpls.test2(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FILE: main.kt
|
||||
@JvmDefaultWithCompatibility
|
||||
interface KDerived : JDerived {
|
||||
override public fun test2(): String = "K"
|
||||
}
|
||||
|
||||
class KClass : KDerived
|
||||
|
||||
fun box(): String {
|
||||
val kClass = KClass()
|
||||
val value = kClass.test() + kClass.test2() + kClass.test3()
|
||||
if (value != "OK") return "fail 1: $value"
|
||||
val jClass = JClass()
|
||||
return jClass.test() + jClass.test2() + jClass.test3()
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
@kotlin.Metadata
|
||||
public interface KBase {
|
||||
// source: 'KBase.kt'
|
||||
public @org.jetbrains.annotations.NotNull method test(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class KClass {
|
||||
// source: 'main.kt'
|
||||
public method <init>(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class KDerived$DefaultImpls {
|
||||
// source: 'main.kt'
|
||||
public deprecated static @java.lang.Deprecated @org.jetbrains.annotations.NotNull method test2(@org.jetbrains.annotations.NotNull p0: KDerived): java.lang.String
|
||||
public final inner class KDerived$DefaultImpls
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface KDerived {
|
||||
// source: 'main.kt'
|
||||
public synthetic static method access$test2$jd(p0: KDerived): java.lang.String
|
||||
public @org.jetbrains.annotations.NotNull method test2(): java.lang.String
|
||||
public final inner class KDerived$DefaultImpls
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class MainKt {
|
||||
// source: 'main.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
Reference in New Issue
Block a user