JvmDefault. Support @JvmDefaultWithCompatibility annotation

#KT-48217 Fixed
This commit is contained in:
Mikhael Bogdanov
2021-12-02 16:04:08 +01:00
parent feefaf2273
commit ea58c858d1
24 changed files with 345 additions and 4 deletions
@@ -3227,6 +3227,9 @@ public final class kotlin/jvm/JvmClassMappingKt {
public abstract interface annotation class kotlin/jvm/JvmDefault : java/lang/annotation/Annotation {
}
public abstract interface annotation class kotlin/jvm/JvmDefaultWithCompatibility : java/lang/annotation/Annotation {
}
public abstract interface annotation class kotlin/jvm/JvmDefaultWithoutCompatibility : java/lang/annotation/Annotation {
}
@@ -140,5 +140,15 @@ public class KotlinpTestGenerated extends AbstractKotlinpTest {
public void testAllFilesPresentInJvmDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("libraries/tools/kotlinp/testData/jvmDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("withCompatibility.kt")
public void testWithCompatibility() throws Exception {
runTest("libraries/tools/kotlinp/testData/jvmDefault/withCompatibility.kt");
}
@TestMetadata("withoutCompatibility.kt")
public void testWithoutCompatibility() throws Exception {
runTest("libraries/tools/kotlinp/testData/jvmDefault/withoutCompatibility.kt");
}
}
}
@@ -0,0 +1,8 @@
// !JVM_DEFAULT_MODE: all
@JvmDefaultWithCompatibility
interface A {
fun f() {}
}
@JvmDefaultWithCompatibility
interface B : A
@@ -0,0 +1,35 @@
// A.class
// ------------------------------------------
// requires compiler version 1.4.0 (level=ERROR)
public abstract interface A : kotlin/Any {
// signature: f()V
public open fun f(): kotlin/Unit
// module name: test-module
// has method bodies in interface
// is compiled in compatibility mode
}
// A$DefaultImpls.class
// ------------------------------------------
synthetic class
// B.class
// ------------------------------------------
// requires compiler version 1.4.0 (level=ERROR)
public abstract interface B : A {
// module name: test-module
// has method bodies in interface
// is compiled in compatibility mode
}
// B$DefaultImpls.class
// ------------------------------------------
synthetic class
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,7 @@
// !JVM_DEFAULT_MODE: all-compatibility
@JvmDefaultWithoutCompatibility
interface A {
fun f() {}
}
interface B : A
@@ -0,0 +1,28 @@
// A.class
// ------------------------------------------
public abstract interface A : kotlin/Any {
// signature: f()V
public open fun f(): kotlin/Unit
// module name: test-module
// has method bodies in interface
}
// B.class
// ------------------------------------------
public abstract interface B : A {
// module name: test-module
// has method bodies in interface
// is compiled in compatibility mode
}
// B$DefaultImpls.class
// ------------------------------------------
synthetic class
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}