diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 44b2a508db1..e1ffb514a33 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -14901,6 +14901,89 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/jvm8/defaults/superCall.kt"); } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/allCompatibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AllCompatibility extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInAllCompatibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("bridge.kt") + public void testBridge() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt"); + } + + @TestMetadata("bridge2.kt") + public void testBridge2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt"); + } + + @TestMetadata("bridge3.kt") + public void testBridge3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt"); + } + + @TestMetadata("bridgeWithProperties.kt") + public void testBridgeWithProperties() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt"); + } + + @TestMetadata("bridgeWithProperties2.kt") + public void testBridgeWithProperties2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt"); + } + + @TestMetadata("bridgeWithProperties3.kt") + public void testBridgeWithProperties3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt"); + } + + @TestMetadata("callStackTrace.kt") + public void testCallStackTrace() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt"); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgs.kt"); + } + + @TestMetadata("defaultArgsViaAnonymousObject.kt") + public void testDefaultArgsViaAnonymousObject() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt"); + } + + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") + public void testInheritedFunctionWithDefaultParameters() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedFunctionWithDefaultParameters.kt"); + } + + @TestMetadata("inheritedJvmDefault.kt") + public void testInheritedJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt"); + } + + @TestMetadata("interfaceExtension.kt") + public void testInterfaceExtension() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/interfaceExtension.kt"); + } + + @TestMetadata("propertyAnnotation.kt") + public void testPropertyAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/propertyAnnotation.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -15002,6 +15085,84 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NoDefaultImpls extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("bridge.kt") + public void testBridge() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt"); + } + + @TestMetadata("bridge2.kt") + public void testBridge2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt"); + } + + @TestMetadata("bridge3.kt") + public void testBridge3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt"); + } + + @TestMetadata("bridgeWithProperties.kt") + public void testBridgeWithProperties() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt"); + } + + @TestMetadata("bridgeWithProperties2.kt") + public void testBridgeWithProperties2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt"); + } + + @TestMetadata("bridgeWithProperties3.kt") + public void testBridgeWithProperties3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt"); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgs.kt"); + } + + @TestMetadata("defaultArgsViaAnonymousObject.kt") + public void testDefaultArgsViaAnonymousObject() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgsViaAnonymousObject.kt"); + } + + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") + public void testInheritedFunctionWithDefaultParameters() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedFunctionWithDefaultParameters.kt"); + } + + @TestMetadata("inheritedJvmDefault.kt") + public void testInheritedJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt"); + } + + @TestMetadata("interfaceExtension.kt") + public void testInterfaceExtension() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/interfaceExtension.kt"); + } + + @TestMetadata("propertyAnnotation.kt") + public void testPropertyAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/propertyAnnotation.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt new file mode 100644 index 00000000000..205053719b8 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt @@ -0,0 +1,38 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface2 { + default String test() { + return KInterface2.DefaultImpls.test2(this, "OK"); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun test2(p: T): T { + return p + } +} + +interface KInterface2 : KInterface { + +} + + +fun box(): String { + + val result = Foo().test() + if (result != "OK") return "fail 1: ${result}" + + return Foo().test2("OK") +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt new file mode 100644 index 00000000000..2af4393c031 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt @@ -0,0 +1,35 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface2 { + default String test() { + return KInterface2.DefaultImpls.test2(this, "OK"); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + public String test2(String p) { + return "fail"; + } +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun test2(p: T): T { + return p + } +} + +interface KInterface2 : KInterface { + +} + + +fun box(): String { + return Foo().test() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt new file mode 100644 index 00000000000..9b0580bc2a9 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt @@ -0,0 +1,39 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface3 { + default String test() { + return KInterface3.DefaultImpls.test2(this, "OK"); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + public String test2(String p) { + return "fail"; + } +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun test2(p: T): T { + return p + } +} + +interface KInterface2 : KInterface { + +} + +interface KInterface3 : KInterface2 { + +} + + +fun box(): String { + return Foo().test() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt new file mode 100644 index 00000000000..0b03617bdd6 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt @@ -0,0 +1,42 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface2 { + default String test() { + return KInterface2.DefaultImpls.getBar(this); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + + val foo: T + + val bar: T + get() = foo +} + +interface KInterface2 : KInterface { + override val foo: String + get() = "OK" +} + + +fun box(): String { + + val result = Foo().test() + if (result != "OK") return "fail 1: ${result}" + + return Foo().bar + +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt new file mode 100644 index 00000000000..e27fa742223 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt @@ -0,0 +1,39 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface2 { + default String test() { + return KInterface2.DefaultImpls.getBar(this); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + public String getBar() { + return "fail"; + } +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + + val foo: T + + val bar: T + get() = foo +} + +interface KInterface2 : KInterface { + override val foo: String + get() = "OK" +} + + +fun box(): String { + return Foo().test() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt new file mode 100644 index 00000000000..ee15fb3d87f --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt @@ -0,0 +1,41 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface3 { + default String test() { + return KInterface3.DefaultImpls.getBar(this); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + + val foo: T + + val bar: T + get() = foo +} + +interface KInterface2 : KInterface { + override val foo: String + get() = "OK" +} + +interface KInterface3 : KInterface2 { + +} + + +fun box(): String { + return Foo().test() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt new file mode 100644 index 00000000000..7b291b7f4e9 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt @@ -0,0 +1,43 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FULL_JDK +// WITH_RUNTIME +// FILE: Simple.java + +public interface Simple extends KInterface { + default java.util.List compatibilityCall() { + return KInterface.DefaultImpls.call(this); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun call(): List { + return Thread.currentThread().getStackTrace().map { it.className + "." + it.methodName } + } +} + + +fun box(): String { + var result = Foo().compatibilityCall() + if (result[1] != "KInterface.call") return "fail 1: ${result[1]}" + if (result[2] != "KInterface.access\$call\$jd") return "fail 2: ${result[2]}" + if (result[3] != "KInterface\$DefaultImpls.call") return "fail 3: ${result[3]}" + if (result[4] != "Simple.compatibilityCall") return "fail 4: ${result[4]}" + if (result[5] != "MainKt.box") return "fail 5: ${result[5]}" + + result = Foo().call() + if (result[1] != "KInterface.call") return "fail 1: ${result[1]}" + if (result[2] != "MainKt.box") return "fail 2: ${result[2]}" + + return "OK" +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgs.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgs.kt new file mode 100644 index 00000000000..ccb02dee0ee --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgs.kt @@ -0,0 +1,23 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// FULL_JDK + +interface Test { + fun test(s: String ="OK"): String { + return s + } +} + +class TestClass : Test { + +} + +fun box(): String { + val defaultImpls = java.lang.Class.forName(Test::class.java.canonicalName + "\$DefaultImpls") + + val declaredMethod = defaultImpls.getDeclaredMethod("test\$default", Test::class.java, String::class.java, Int::class.java, Any::class.java) + return declaredMethod.invoke(null, TestClass(), null, 1, null) as String +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt new file mode 100644 index 00000000000..b33e473b1a6 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt @@ -0,0 +1,16 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface A { + fun foo(x: String = "OK"): String { + return x + } +} + +fun box(): String { + val x = object : A {} + return x.foo() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedFunctionWithDefaultParameters.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedFunctionWithDefaultParameters.kt new file mode 100644 index 00000000000..88a3d83cbdd --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedFunctionWithDefaultParameters.kt @@ -0,0 +1,12 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +interface I { + fun foo(x: String = "OK"): String = x +} + +interface J : I + +object O : J + +fun box(): String = O.foo() diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt new file mode 100644 index 00000000000..8b626de311d --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt @@ -0,0 +1,37 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface2 { + default String test() { + return KInterface2.DefaultImpls.test2(this); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun test2(): String { + return "OK" + } +} + +interface KInterface2 : KInterface { + +} + + +fun box(): String { + val result = Foo().test() + if (result != "OK") return "fail 1: ${result}" + + return Foo().test2() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/interfaceExtension.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/interfaceExtension.kt new file mode 100644 index 00000000000..7b76cd88d14 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/interfaceExtension.kt @@ -0,0 +1,13 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// !JVM_DEFAULT_MODE: all-compatibility +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME +interface A { + fun String.foo(k: String) = "O" + k +} + +fun box(): String = + object : A { + fun box() = "FAIL".foo("K") + }.box() diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/propertyAnnotation.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/propertyAnnotation.kt new file mode 100644 index 00000000000..98a75e02878 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/propertyAnnotation.kt @@ -0,0 +1,24 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_REFLECT + +annotation class Property(val value: String) +annotation class Accessor(val value: String) + +interface Z { + @Property("OK") + val z: String + @Accessor("OK") + get() = "OK" +} + + +class Test : Z + +fun box() : String { + val value = Z::z.annotations.filterIsInstance().single().value + if (value != "OK") return value + return (Z::z.getter.annotations.single() as Accessor).value +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt new file mode 100644 index 00000000000..d8f61266592 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt @@ -0,0 +1,33 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// 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 +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun test2(): String { + return "OK" + } +} + + +fun box(): String { + val result = Foo().test() + if (result != "OK") return "fail 1: ${result}" + + return Foo().test2() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedFunctionWithDefaultParameters.kt b/compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedFunctionWithDefaultParameters.kt index 0bc3583db64..13abb55f637 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedFunctionWithDefaultParameters.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedFunctionWithDefaultParameters.kt @@ -1,7 +1,9 @@ // !JVM_DEFAULT_MODE: compatibility // TARGET_BACKEND: JVM - +// JVM_TARGET: 1.8 +// WITH_RUNTIME interface I { + @JvmDefault fun foo(x: String = "OK"): String = x } diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt new file mode 100644 index 00000000000..fbd3dfb88f7 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt @@ -0,0 +1,38 @@ +// !JVM_DEFAULT_MODE: all +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface2 { + default String test() { + return KInterface2.super.test2("OK"); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun test2(p: T): T { + return p + } +} + +interface KInterface2 : KInterface { + +} + + +fun box(): String { + + val result = Foo().test() + if (result != "OK") return "fail 1: ${result}" + + return Foo().test2("OK") +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt new file mode 100644 index 00000000000..32a7e78335d --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt @@ -0,0 +1,35 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface2 { + default String test() { + return KInterface2.super.test2("OK"); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + public String test2(String p) { + return "fail"; + } +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun test2(p: T): T { + return p + } +} + +interface KInterface2 : KInterface { + +} + + +fun box(): String { + return Foo().test() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt new file mode 100644 index 00000000000..ab8518269a4 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt @@ -0,0 +1,39 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface3 { + default String test() { + return KInterface3.super.test2("OK"); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + public String test2(String p) { + return "fail"; + } +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun test2(p: T): T { + return p + } +} + +interface KInterface2 : KInterface { + +} + +interface KInterface3 : KInterface2 { + +} + + +fun box(): String { + return Foo().test() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt new file mode 100644 index 00000000000..ca56b22755b --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt @@ -0,0 +1,42 @@ +// !JVM_DEFAULT_MODE: all +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface2 { + default String test() { + return getBar(); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + + val foo: T + + val bar: T + get() = foo +} + +interface KInterface2 : KInterface { + override val foo: String + get() = "OK" +} + + +fun box(): String { + + val result = Foo().test() + if (result != "OK") return "fail 1: ${result}" + + return Foo().bar + +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt new file mode 100644 index 00000000000..3d064e532c6 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt @@ -0,0 +1,39 @@ +// !JVM_DEFAULT_MODE: all +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface2 { + default String test() { + return KInterface2.super.getBar(); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + public String getBar() { + return "fail"; + } +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + + val foo: T + + val bar: T + get() = foo +} + +interface KInterface2 : KInterface { + override val foo: String + get() = "OK" +} + + +fun box(): String { + return Foo().test() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt new file mode 100644 index 00000000000..cc4bf3b093d --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt @@ -0,0 +1,41 @@ +// !JVM_DEFAULT_MODE: all +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface3 { + default String test() { + return getBar(); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + + val foo: T + + val bar: T + get() = foo +} + +interface KInterface2 : KInterface { + override val foo: String + get() = "OK" +} + +interface KInterface3 : KInterface2 { + +} + + +fun box(): String { + return Foo().test() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgs.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgs.kt new file mode 100644 index 00000000000..ff735f391e1 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgs.kt @@ -0,0 +1,24 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// FULL_JDK + +interface Test { + fun test(s: String ="OK"): String { + return s + } +} + +class TestClass : Test { + +} + +fun box(): String { + try { + val defaultImpls = java.lang.Class.forName(Test::class.java.canonicalName + "\$DefaultImpls") + } catch (e: ClassNotFoundException) { + return "OK" + } + return "fail: DefaultImpls shouldn't be generated" +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgsViaAnonymousObject.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgsViaAnonymousObject.kt new file mode 100644 index 00000000000..d28d9f10813 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgsViaAnonymousObject.kt @@ -0,0 +1,16 @@ +// !JVM_DEFAULT_MODE: all +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface A { + fun foo(x: String = "OK"): String { + return x + } +} + +fun box(): String { + val x = object : A {} + return x.foo() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedFunctionWithDefaultParameters.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedFunctionWithDefaultParameters.kt new file mode 100644 index 00000000000..f2bcbcbf8a5 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedFunctionWithDefaultParameters.kt @@ -0,0 +1,12 @@ +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +interface I { + fun foo(x: String = "OK"): String = x +} + +interface J : I + +object O : J + +fun box(): String = O.foo() diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt new file mode 100644 index 00000000000..61c0309ccd0 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt @@ -0,0 +1,37 @@ +// !JVM_DEFAULT_MODE: all +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface2 { + default String test() { + return test2(); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun test2(): String { + return "OK" + } +} + +interface KInterface2 : KInterface { + +} + + +fun box(): String { + val result = Foo().test() + if (result != "OK") return "fail 1: ${result}" + + return Foo().test2() +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/interfaceExtension.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/interfaceExtension.kt new file mode 100644 index 00000000000..bf0de739196 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/interfaceExtension.kt @@ -0,0 +1,13 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// !JVM_DEFAULT_MODE: all +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME +interface A { + fun String.foo(k: String) = "O" + k +} + +fun box(): String = + object : A { + fun box() = "FAIL".foo("K") + }.box() diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/propertyAnnotation.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/propertyAnnotation.kt new file mode 100644 index 00000000000..661a3959804 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/propertyAnnotation.kt @@ -0,0 +1,24 @@ +// !JVM_DEFAULT_MODE: all +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_REFLECT + +annotation class Property(val value: String) +annotation class Accessor(val value: String) + +interface Z { + @Property("OK") + val z: String + @Accessor("OK") + get() = "OK" +} + + +class Test : Z + +fun box() : String { + val value = Z::z.annotations.filterIsInstance().single().value + if (value != "OK") return value + return (Z::z.getter.annotations.single() as Accessor).value +} diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt new file mode 100644 index 00000000000..a7529fe69a9 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt @@ -0,0 +1,33 @@ +// !JVM_DEFAULT_MODE: all +// IGNORE_BACKEND_FIR: JVM_IR +// TARGET_BACKEND: JVM +// FILE: Simple.java + +public interface Simple extends KInterface { + default String test() { + return test2(); + } +} + +// FILE: Foo.java +public class Foo implements Simple { + +} + +// FILE: main.kt +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface KInterface { + fun test2(): String { + return "OK" + } +} + + +fun box(): String { + val result = Foo().test() + if (result != "OK") return "fail 1: ${result}" + + return Foo().test2() +} diff --git a/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/defaultArgs.kt b/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/defaultArgs.kt new file mode 100644 index 00000000000..35594094cb3 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/defaultArgs.kt @@ -0,0 +1,19 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 +// FULL_JDK + +interface KInterface { + + fun test(s: String ="OK"): String { + return s + } +} + +// 1 INVOKESTATIC KInterface.access\$test\$jd +// 1 INVOKESTATIC KInterface.test\$default + +// from $default +// 1 INVOKEINTERFACE KInterface.test + +//from $jd +// 1 INVOKESPECIAL KInterface.test diff --git a/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleDiamond.kt b/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleDiamond.kt new file mode 100644 index 00000000000..2f303cb1ead --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleDiamond.kt @@ -0,0 +1,22 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 + +interface A { + + fun foo() = "FAIL" +} + +interface Left : A { } +interface Right : A { + + override fun foo() = "OK" +} + +interface C : Left, Right {} + +fun box(): String { + val x = object : C {} + return x.foo() +} + +// 0 INVOKESTATIC .*\$DefaultImpls\.foo diff --git a/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleFunction.kt b/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleFunction.kt new file mode 100644 index 00000000000..bc4f433ea92 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleFunction.kt @@ -0,0 +1,18 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 + +interface KInterface { + fun test2(): String { + return "OK" + } +} + +interface KInterface2 : KInterface { + +} + +// 1 INVOKESTATIC KInterface2.access\$test2\$jd +// 1 INVOKESTATIC KInterface.access\$test2\$jd + +// 1 INVOKESPECIAL KInterface2.test2 +// 1 INVOKESPECIAL KInterface.test2 diff --git a/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleFunctionWithAbstractOverride.kt b/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleFunctionWithAbstractOverride.kt new file mode 100644 index 00000000000..7133b2d29f4 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleFunctionWithAbstractOverride.kt @@ -0,0 +1,21 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 + +interface KInterface { + fun test2(): String { + return "OK" + } +} + +interface KInterface2 : KInterface { + abstract override fun test2(): String +} + +// 1 INVOKESTATIC KInterface.access\$test2\$jd +// + +// 0 INVOKESTATIC KInterface2.access\$test2\$jd +// = +// 1 INVOKESTATIC KInterface + +// 1 INVOKESPECIAL KInterface.test2 +// 0 INVOKESPECIAL KInterface2.test2 diff --git a/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleProperty.kt b/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleProperty.kt new file mode 100644 index 00000000000..3918d70b7f9 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleProperty.kt @@ -0,0 +1,23 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 + +interface KInterface { + + var bar: String + get() = "OK" + set(field) {} +} + +interface KInterface2 : KInterface { + +} + +// 1 INVOKESTATIC KInterface2.access\$getBar\$jd +// 1 INVOKESTATIC KInterface2.access\$setBar\$jd +// 1 INVOKESTATIC KInterface.access\$getBar\$jd +// 1 INVOKESTATIC KInterface.access\$setBar\$jd + +// 1 INVOKESPECIAL KInterface2.getBar +// 1 INVOKESPECIAL KInterface2.setBar +// 1 INVOKESPECIAL KInterface.getBar +// 1 INVOKESPECIAL KInterface.setBar diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/callStackTrace.kt b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/callStackTrace.kt new file mode 100644 index 00000000000..1142321a241 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/callStackTrace.kt @@ -0,0 +1,34 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 +// FULL_JDK +// FILE: 1.kt +interface KInterface { + fun call(): List { + return Thread.currentThread().getStackTrace().map { it.className + "." + it.methodName } + } + + fun superCall() = Thread.currentThread().getStackTrace().map { it.className + "." + it.methodName } +} + +// FILE: main.kt +interface KInterface2 : KInterface { + +} + +class Foo: KInterface2 { + fun superCall2() = super.superCall() +} + +fun box(): String { + var result = Foo().call() + if (result[1] != "KInterface.call") return "fail 1: ${result[1]}" + if (result[2] != "MainKt.box") return "fail 2: ${result[2]}" + + result = Foo().superCall2() + if (result[1] != "KInterface.superCall") return "fail 1: ${result[1]}" + if (result[2] != "Foo.superCall2") return "fail 2: ${result[2]}" + if (result[3] != "MainKt.box") return "fail 3: ${result[3]}" + + + return "OK" +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCall.kt b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCall.kt new file mode 100644 index 00000000000..6de59beeec0 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCall.kt @@ -0,0 +1,20 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// FILE: 1.kt +interface Test { + fun test(): String { + return "OK" + } +} + +// FILE: 2.kt +class TestClass : Test { + override fun test(): String { + return super.test() + } +} + +fun box(): String { + return TestClass().test() +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCallFromInterface.kt b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCallFromInterface.kt new file mode 100644 index 00000000000..f4e6944bf84 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCallFromInterface.kt @@ -0,0 +1,21 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// FILE: 1.kt +interface Test { + fun test(): String { + return "OK" + } +} + +// FILE: 2.kt + +interface Test2 : Test { + override fun test(): String { + return super.test() + } +} + +fun box(): String { + return object : Test2 {}.test() +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCallFromInterface2.kt b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCallFromInterface2.kt new file mode 100644 index 00000000000..6d8f1273b90 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCallFromInterface2.kt @@ -0,0 +1,25 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// FILE: 1.kt +interface Test { + fun test(): String { + return "OK" + } + + fun defaultImplTrigger(): String { + return "OK" + } +} + +// FILE: 2.kt + +interface Test2 : Test { + override fun test(): String { + return super.test() + } +} + +fun box(): String { + return object : Test2 {}.test() +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccess.kt b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccess.kt new file mode 100644 index 00000000000..86a85c2158c --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccess.kt @@ -0,0 +1,18 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// FILE: 1.kt +interface Test { + val prop: String + get() = "OK" +} + +// FILE: 2.kt +class TestClass : Test { + override val prop: String + get() = super.prop +} + +fun box(): String { + return TestClass().prop +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccessFromInterface.kt b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccessFromInterface.kt new file mode 100644 index 00000000000..dc3419e08ed --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccessFromInterface.kt @@ -0,0 +1,18 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// FILE: 1.kt +interface Test { + val prop: String + get() = "OK" +} + +// FILE: 2.kt +interface Test2 : Test { + override val prop: String + get() = super.prop +} + +fun box(): String { + return object : Test2 {}.prop +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccessFromInterface2.kt b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccessFromInterface2.kt new file mode 100644 index 00000000000..65d77df390a --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccessFromInterface2.kt @@ -0,0 +1,21 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// FILE: 1.kt +interface Test { + val prop: String + get() = "OK" + + val defaultImplTrigger: String + get() = "OK" +} + +// FILE: 2.kt +interface Test2 : Test { + override val prop: String + get() = super.prop +} + +fun box(): String { + return object : Test2 {}.prop +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index be754883f1a..e9f041a54e4 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -16116,6 +16116,89 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/jvm8/defaults/superCall.kt"); } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/allCompatibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AllCompatibility extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInAllCompatibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("bridge.kt") + public void testBridge() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt"); + } + + @TestMetadata("bridge2.kt") + public void testBridge2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt"); + } + + @TestMetadata("bridge3.kt") + public void testBridge3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt"); + } + + @TestMetadata("bridgeWithProperties.kt") + public void testBridgeWithProperties() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt"); + } + + @TestMetadata("bridgeWithProperties2.kt") + public void testBridgeWithProperties2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt"); + } + + @TestMetadata("bridgeWithProperties3.kt") + public void testBridgeWithProperties3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt"); + } + + @TestMetadata("callStackTrace.kt") + public void testCallStackTrace() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt"); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgs.kt"); + } + + @TestMetadata("defaultArgsViaAnonymousObject.kt") + public void testDefaultArgsViaAnonymousObject() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt"); + } + + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") + public void testInheritedFunctionWithDefaultParameters() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedFunctionWithDefaultParameters.kt"); + } + + @TestMetadata("inheritedJvmDefault.kt") + public void testInheritedJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt"); + } + + @TestMetadata("interfaceExtension.kt") + public void testInterfaceExtension() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/interfaceExtension.kt"); + } + + @TestMetadata("propertyAnnotation.kt") + public void testPropertyAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/propertyAnnotation.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -16217,6 +16300,84 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NoDefaultImpls extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("bridge.kt") + public void testBridge() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt"); + } + + @TestMetadata("bridge2.kt") + public void testBridge2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt"); + } + + @TestMetadata("bridge3.kt") + public void testBridge3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt"); + } + + @TestMetadata("bridgeWithProperties.kt") + public void testBridgeWithProperties() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt"); + } + + @TestMetadata("bridgeWithProperties2.kt") + public void testBridgeWithProperties2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt"); + } + + @TestMetadata("bridgeWithProperties3.kt") + public void testBridgeWithProperties3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt"); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgs.kt"); + } + + @TestMetadata("defaultArgsViaAnonymousObject.kt") + public void testDefaultArgsViaAnonymousObject() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgsViaAnonymousObject.kt"); + } + + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") + public void testInheritedFunctionWithDefaultParameters() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedFunctionWithDefaultParameters.kt"); + } + + @TestMetadata("inheritedJvmDefault.kt") + public void testInheritedJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt"); + } + + @TestMetadata("interfaceExtension.kt") + public void testInterfaceExtension() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/interfaceExtension.kt"); + } + + @TestMetadata("propertyAnnotation.kt") + public void testPropertyAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/propertyAnnotation.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index d830af1907e..9503bb59310 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -3193,6 +3193,44 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @TestMetadata("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AllCompatibility extends AbstractBytecodeTextTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInAllCompatibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/defaultArgs.kt"); + } + + @TestMetadata("simpleDiamond.kt") + public void testSimpleDiamond() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleDiamond.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleFunction.kt"); + } + + @TestMetadata("simpleFunctionWithAbstractOverride.kt") + public void testSimpleFunctionWithAbstractOverride() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleFunctionWithAbstractOverride.kt"); + } + + @TestMetadata("simpleProperty.kt") + public void testSimpleProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleProperty.kt"); + } + } + @TestMetadata("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 00ff4d1db54..2652475ea6c 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -411,6 +411,54 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl public void testSuperPropAccessFromInterface2() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/superPropAccessFromInterface2.kt"); } + + @TestMetadata("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AllCompatibility extends AbstractCompileKotlinAgainstKotlinTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInAllCompatibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("callStackTrace.kt") + public void testCallStackTrace() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/callStackTrace.kt"); + } + + @TestMetadata("superCall.kt") + public void testSuperCall() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCall.kt"); + } + + @TestMetadata("superCallFromInterface.kt") + public void testSuperCallFromInterface() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCallFromInterface.kt"); + } + + @TestMetadata("superCallFromInterface2.kt") + public void testSuperCallFromInterface2() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCallFromInterface2.kt"); + } + + @TestMetadata("superPropAccess.kt") + public void testSuperPropAccess() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccess.kt"); + } + + @TestMetadata("superPropAccessFromInterface.kt") + public void testSuperPropAccessFromInterface() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccessFromInterface.kt"); + } + + @TestMetadata("superPropAccessFromInterface2.kt") + public void testSuperPropAccessFromInterface2() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccessFromInterface2.kt"); + } + } } @TestMetadata("compiler/testData/compileKotlinAgainstKotlin/jvm8/jvm8against6") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 5908d718c02..5ff29a02ba8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -16116,6 +16116,89 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/jvm8/defaults/superCall.kt"); } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/allCompatibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AllCompatibility extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInAllCompatibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("bridge.kt") + public void testBridge() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt"); + } + + @TestMetadata("bridge2.kt") + public void testBridge2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt"); + } + + @TestMetadata("bridge3.kt") + public void testBridge3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt"); + } + + @TestMetadata("bridgeWithProperties.kt") + public void testBridgeWithProperties() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt"); + } + + @TestMetadata("bridgeWithProperties2.kt") + public void testBridgeWithProperties2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt"); + } + + @TestMetadata("bridgeWithProperties3.kt") + public void testBridgeWithProperties3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt"); + } + + @TestMetadata("callStackTrace.kt") + public void testCallStackTrace() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt"); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgs.kt"); + } + + @TestMetadata("defaultArgsViaAnonymousObject.kt") + public void testDefaultArgsViaAnonymousObject() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt"); + } + + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") + public void testInheritedFunctionWithDefaultParameters() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedFunctionWithDefaultParameters.kt"); + } + + @TestMetadata("inheritedJvmDefault.kt") + public void testInheritedJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt"); + } + + @TestMetadata("interfaceExtension.kt") + public void testInterfaceExtension() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/interfaceExtension.kt"); + } + + @TestMetadata("propertyAnnotation.kt") + public void testPropertyAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/propertyAnnotation.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -16217,6 +16300,84 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NoDefaultImpls extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("bridge.kt") + public void testBridge() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt"); + } + + @TestMetadata("bridge2.kt") + public void testBridge2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt"); + } + + @TestMetadata("bridge3.kt") + public void testBridge3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt"); + } + + @TestMetadata("bridgeWithProperties.kt") + public void testBridgeWithProperties() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt"); + } + + @TestMetadata("bridgeWithProperties2.kt") + public void testBridgeWithProperties2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt"); + } + + @TestMetadata("bridgeWithProperties3.kt") + public void testBridgeWithProperties3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt"); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgs.kt"); + } + + @TestMetadata("defaultArgsViaAnonymousObject.kt") + public void testDefaultArgsViaAnonymousObject() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgsViaAnonymousObject.kt"); + } + + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") + public void testInheritedFunctionWithDefaultParameters() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedFunctionWithDefaultParameters.kt"); + } + + @TestMetadata("inheritedJvmDefault.kt") + public void testInheritedJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt"); + } + + @TestMetadata("interfaceExtension.kt") + public void testInterfaceExtension() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/interfaceExtension.kt"); + } + + @TestMetadata("propertyAnnotation.kt") + public void testPropertyAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/propertyAnnotation.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 6a98c1c7824..b0952baccf7 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -14901,6 +14901,89 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/jvm8/defaults/superCall.kt"); } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/allCompatibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AllCompatibility extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInAllCompatibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("bridge.kt") + public void testBridge() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt"); + } + + @TestMetadata("bridge2.kt") + public void testBridge2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt"); + } + + @TestMetadata("bridge3.kt") + public void testBridge3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt"); + } + + @TestMetadata("bridgeWithProperties.kt") + public void testBridgeWithProperties() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt"); + } + + @TestMetadata("bridgeWithProperties2.kt") + public void testBridgeWithProperties2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt"); + } + + @TestMetadata("bridgeWithProperties3.kt") + public void testBridgeWithProperties3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt"); + } + + @TestMetadata("callStackTrace.kt") + public void testCallStackTrace() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt"); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgs.kt"); + } + + @TestMetadata("defaultArgsViaAnonymousObject.kt") + public void testDefaultArgsViaAnonymousObject() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt"); + } + + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") + public void testInheritedFunctionWithDefaultParameters() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedFunctionWithDefaultParameters.kt"); + } + + @TestMetadata("inheritedJvmDefault.kt") + public void testInheritedJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt"); + } + + @TestMetadata("interfaceExtension.kt") + public void testInterfaceExtension() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/interfaceExtension.kt"); + } + + @TestMetadata("propertyAnnotation.kt") + public void testPropertyAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/propertyAnnotation.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -15002,6 +15085,84 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NoDefaultImpls extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("bridge.kt") + public void testBridge() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt"); + } + + @TestMetadata("bridge2.kt") + public void testBridge2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt"); + } + + @TestMetadata("bridge3.kt") + public void testBridge3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt"); + } + + @TestMetadata("bridgeWithProperties.kt") + public void testBridgeWithProperties() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt"); + } + + @TestMetadata("bridgeWithProperties2.kt") + public void testBridgeWithProperties2() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt"); + } + + @TestMetadata("bridgeWithProperties3.kt") + public void testBridgeWithProperties3() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt"); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgs.kt"); + } + + @TestMetadata("defaultArgsViaAnonymousObject.kt") + public void testDefaultArgsViaAnonymousObject() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgsViaAnonymousObject.kt"); + } + + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") + public void testInheritedFunctionWithDefaultParameters() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedFunctionWithDefaultParameters.kt"); + } + + @TestMetadata("inheritedJvmDefault.kt") + public void testInheritedJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt"); + } + + @TestMetadata("interfaceExtension.kt") + public void testInterfaceExtension() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/interfaceExtension.kt"); + } + + @TestMetadata("propertyAnnotation.kt") + public void testPropertyAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/propertyAnnotation.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java index caf60eff763..2450225c698 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java @@ -3238,6 +3238,44 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AllCompatibility extends AbstractIrBytecodeTextTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInAllCompatibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("defaultArgs.kt") + public void testDefaultArgs() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/defaultArgs.kt"); + } + + @TestMetadata("simpleDiamond.kt") + public void testSimpleDiamond() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleDiamond.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleFunction.kt"); + } + + @TestMetadata("simpleFunctionWithAbstractOverride.kt") + public void testSimpleFunctionWithAbstractOverride() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleFunctionWithAbstractOverride.kt"); + } + + @TestMetadata("simpleProperty.kt") + public void testSimpleProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/allCompatibility/simpleProperty.kt"); + } + } + @TestMetadata("compiler/testData/codegen/bytecodeText/jvm8/jvmDefault/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java index eb80478f202..bac2aea55e7 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java @@ -406,6 +406,54 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile public void testSuperPropAccessFromInterface2() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/superPropAccessFromInterface2.kt"); } + + @TestMetadata("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AllCompatibility extends AbstractIrCompileKotlinAgainstKotlinTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInAllCompatibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("callStackTrace.kt") + public void testCallStackTrace() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/callStackTrace.kt"); + } + + @TestMetadata("superCall.kt") + public void testSuperCall() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCall.kt"); + } + + @TestMetadata("superCallFromInterface.kt") + public void testSuperCallFromInterface() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCallFromInterface.kt"); + } + + @TestMetadata("superCallFromInterface2.kt") + public void testSuperCallFromInterface2() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superCallFromInterface2.kt"); + } + + @TestMetadata("superPropAccess.kt") + public void testSuperPropAccess() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccess.kt"); + } + + @TestMetadata("superPropAccessFromInterface.kt") + public void testSuperPropAccessFromInterface() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccessFromInterface.kt"); + } + + @TestMetadata("superPropAccessFromInterface2.kt") + public void testSuperPropAccessFromInterface2() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvm8/defaults/allCompatibility/superPropAccessFromInterface2.kt"); + } + } } @TestMetadata("compiler/testData/compileKotlinAgainstKotlin/jvm8/jvm8against6") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index a3988976232..e25c02af586 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -12596,6 +12596,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/allCompatibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AllCompatibility extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInAllCompatibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -12622,6 +12635,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NoDefaultImpls extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index da86edbd7b5..fea29d8bf8d 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -12661,6 +12661,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/allCompatibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AllCompatibility extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInAllCompatibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/compatibility") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -12687,6 +12700,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NoDefaultImpls extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + } + @TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDelegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)