JvmDefault. Support @JvmDefaultWithCompatibility annotation
#KT-48217 Fixed
This commit is contained in:
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// !JVM_DEFAULT_MODE: all
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
// CHECK_BYTECODE_LISTING
|
||||
|
||||
@JvmDefaultWithCompatibility
|
||||
interface Test {
|
||||
fun test(s: String ="OK"): String {
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
||||
class TestClass : Test {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return TestClass().test()
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
@kotlin.Metadata
|
||||
public final class DefaultArgsKt {
|
||||
// source: 'defaultArgs.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Test$DefaultImpls {
|
||||
// source: 'defaultArgs.kt'
|
||||
public synthetic static method test$default(p0: Test, p1: java.lang.String, p2: int, p3: java.lang.Object): java.lang.String
|
||||
public deprecated static @java.lang.Deprecated @org.jetbrains.annotations.NotNull method test(@org.jetbrains.annotations.NotNull p0: Test, @org.jetbrains.annotations.NotNull p1: java.lang.String): java.lang.String
|
||||
public final inner class Test$DefaultImpls
|
||||
}
|
||||
|
||||
@kotlin.jvm.JvmDefaultWithCompatibility
|
||||
@kotlin.Metadata
|
||||
public interface Test {
|
||||
// source: 'defaultArgs.kt'
|
||||
public synthetic static method access$test$jd(p0: Test, p1: java.lang.String): java.lang.String
|
||||
public synthetic static method test$default(p0: Test, p1: java.lang.String, p2: int, p3: java.lang.Object): java.lang.String
|
||||
public @org.jetbrains.annotations.NotNull method test(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public final inner class Test$DefaultImpls
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class TestClass {
|
||||
// source: 'defaultArgs.kt'
|
||||
public method <init>(): void
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// !JVM_DEFAULT_MODE: all
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// IGNORE_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: Simple.java
|
||||
|
||||
public interface Simple extends KInterface {
|
||||
default String test() {
|
||||
return KInterface.DefaultImpls.test2(this);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Foo.java
|
||||
public class Foo implements Simple {
|
||||
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
@JvmDefaultWithCompatibility
|
||||
interface KInterface {
|
||||
fun test2(): String {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val result = Foo().test()
|
||||
if (result != "OK") return "fail 1: ${result}"
|
||||
|
||||
return Foo().test2()
|
||||
}
|
||||
Reference in New Issue
Block a user