diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java index cb81bcabf03..0346dc37c0a 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java @@ -1685,9 +1685,10 @@ public class FunctionCodegen { // Fake overrides in interfaces should be expanded to implementation to make proper default check if (JvmAnnotationUtilKt.checkIsImplementationCompiledToJvmDefault(memberDescriptor, mode)) { - return (kind != OwnerKind.DEFAULT_IMPLS && !isSynthetic) || + boolean isSyntheticInCompatibilityOrJvmDefault = isSynthetic && (mode.isCompatibility() || mode == JvmDefaultMode.ENABLE); + return (kind != OwnerKind.DEFAULT_IMPLS && !isSyntheticInCompatibilityOrJvmDefault) || (kind == OwnerKind.DEFAULT_IMPLS && - (isSynthetic || //TODO: move synthetic method generation into interface + (isSyntheticInCompatibilityOrJvmDefault || (mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration)))); } else { switch (kind) { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index c601d759bd5..5ed1eec647a 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -6836,6 +6836,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop") @TestDataPath("$PROJECT_ROOT") public class Interop { + @Test + @TestMetadata("allAgainsAllCompatibility.kt") + public void testAllAgainsAllCompatibility() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allAgainsAllCompatibility.kt"); + } + + @Test + @TestMetadata("allCompatibilityAgainsAll.kt") + public void testAllCompatibilityAgainsAll() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allCompatibilityAgainsAll.kt"); + } + @Test public void testAllFilesPresentInInterop() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); @@ -6883,6 +6895,22 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/newSchemeWithJvmDefault.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + public class NoDefaultImpls { + @Test + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("superPropAccessFromInterface.kt") + public void testSuperPropAccessFromInterface() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls/superPropAccessFromInterface.kt"); + } + } } @Nested diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt index 2b9345286ff..2fd5719d2f3 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface import org.jetbrains.kotlin.backend.jvm.ir.* +import org.jetbrains.kotlin.config.JvmDefaultMode import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.DescriptorVisibilities @@ -123,9 +124,12 @@ internal class InterfaceLowering(val context: JvmBackendContext) : IrElementTran * 3) Private methods (not compiled to JVM defaults), default parameter dispatchers (not compiled to JVM defaults) * and $annotation methods are always moved without bridges */ - (DescriptorVisibilities.isPrivate(function.visibility) && !function.isCompiledToJvmDefault(jvmDefaultMode)) - || (function.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER && !function.isCompiledToJvmDefault(jvmDefaultMode)) - || function.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS -> { + (!function.isCompiledToJvmDefault(jvmDefaultMode) && (DescriptorVisibilities.isPrivate(function.visibility) + || function.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER + || function.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS)) || + (function.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS && + (isCompatibilityMode || jvmDefaultMode == JvmDefaultMode.ENABLE) && + function.isCompiledToJvmDefault(jvmDefaultMode)) -> { val defaultImpl = createDefaultImpl(function) defaultImpl.body = function.moveBodyTo(defaultImpl) removedFunctions[function.symbol] = defaultImpl.symbol diff --git a/compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allAgainsAllCompatibility.kt b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allAgainsAllCompatibility.kt new file mode 100644 index 00000000000..055632241bf --- /dev/null +++ b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allAgainsAllCompatibility.kt @@ -0,0 +1,31 @@ +// WITH_STDLIB +// JVM_TARGET: 1.8 + +// MODULE: lib +// !JVM_DEFAULT_MODE: all-compatibility +// FILE: 1.kt + +interface Foo { + fun test(p: T) = "fail" + val T.prop: String + get() = "fail" +} + +// MODULE: main(lib) +// !JVM_DEFAULT_MODE: all +// FILE: main.kt +interface Foo2: Foo { + override fun test(p: String) : String = p + + override val String.prop: String + get() = this +} + +interface Foo3: Foo, Foo2 + +class Base : Foo3 + +fun box(): String { + val base = Base() + return base.test("O") + with(base) { "K".prop } +} diff --git a/compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allCompatibilityAgainsAll.kt b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allCompatibilityAgainsAll.kt new file mode 100644 index 00000000000..13d83eaa415 --- /dev/null +++ b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allCompatibilityAgainsAll.kt @@ -0,0 +1,30 @@ +// WITH_STDLIB +// JVM_TARGET: 1.8 +// MODULE: lib +// !JVM_DEFAULT_MODE: all +// FILE: 1.kt + +interface Foo { + fun test(p: T) = "fail" + val T.prop: String + get() = "fail" +} + +// MODULE: main(lib) +// !JVM_DEFAULT_MODE: all-compatibility +// FILE: main.kt +interface Foo2: Foo { + override fun test(p: String) : String = p + + override val String.prop: String + get() = this +} + +interface Foo3: Foo, Foo2 + +class Base : Foo3 + +fun box(): String { + val base = Base() + return base.test("O") + with(base) { "K".prop } +} diff --git a/compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls/superPropAccessFromInterface.kt b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls/superPropAccessFromInterface.kt new file mode 100644 index 00000000000..23dd6a84434 --- /dev/null +++ b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls/superPropAccessFromInterface.kt @@ -0,0 +1,20 @@ +// !JVM_DEFAULT_MODE: all +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// MODULE: lib +// FILE: 1.kt +interface Test { + val prop: String + get() = "OK" +} + +// MODULE: main(lib) +// 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/codegen/bytecodeListing/jvm8/defaults/allCompatibility/interfaceProperty.kt b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/interfaceProperty.kt new file mode 100644 index 00000000000..0b64e462459 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/interfaceProperty.kt @@ -0,0 +1,12 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +@Target(AnnotationTarget.PROPERTY) +annotation class Foo + +interface Deprecated { + + @Foo + val prop: String +} diff --git a/compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/interfaceProperty.txt b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/interfaceProperty.txt new file mode 100644 index 00000000000..aa34008b0d6 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/interfaceProperty.txt @@ -0,0 +1,21 @@ +@kotlin.Metadata +public final class Deprecated$DefaultImpls { + // source: 'interfaceProperty.kt' + public synthetic deprecated static @Foo method getProp$annotations(): void + public final inner class Deprecated$DefaultImpls +} + +@kotlin.Metadata +public interface Deprecated { + // source: 'interfaceProperty.kt' + public abstract @org.jetbrains.annotations.NotNull method getProp(): java.lang.String + public final inner class Deprecated$DefaultImpls +} + +@kotlin.annotation.Target +@java.lang.annotation.Retention +@java.lang.annotation.Target +@kotlin.Metadata +public annotation class Foo { + // source: 'interfaceProperty.kt' +} diff --git a/compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable/interfaceProperty.kt b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable/interfaceProperty.kt new file mode 100644 index 00000000000..45b4edfeec7 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable/interfaceProperty.kt @@ -0,0 +1,11 @@ +// !JVM_DEFAULT_MODE: enable +// JVM_TARGET: 1.8 +// WITH_RUNTIME +@Target(AnnotationTarget.PROPERTY) +annotation class Foo + +interface Deprecated { + + @Foo + val prop: String +} diff --git a/compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable/interfaceProperty.txt b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable/interfaceProperty.txt new file mode 100644 index 00000000000..aa34008b0d6 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable/interfaceProperty.txt @@ -0,0 +1,21 @@ +@kotlin.Metadata +public final class Deprecated$DefaultImpls { + // source: 'interfaceProperty.kt' + public synthetic deprecated static @Foo method getProp$annotations(): void + public final inner class Deprecated$DefaultImpls +} + +@kotlin.Metadata +public interface Deprecated { + // source: 'interfaceProperty.kt' + public abstract @org.jetbrains.annotations.NotNull method getProp(): java.lang.String + public final inner class Deprecated$DefaultImpls +} + +@kotlin.annotation.Target +@java.lang.annotation.Retention +@java.lang.annotation.Target +@kotlin.Metadata +public annotation class Foo { + // source: 'interfaceProperty.kt' +} diff --git a/compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl/interfaceProperty.kt b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl/interfaceProperty.kt new file mode 100644 index 00000000000..ed1e5408e4f --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl/interfaceProperty.kt @@ -0,0 +1,11 @@ +// !JVM_DEFAULT_MODE: all +// JVM_TARGET: 1.8 +// WITH_RUNTIME +@Target(AnnotationTarget.PROPERTY) +annotation class Foo + +interface Deprecated { + + @Foo + val prop: String +} diff --git a/compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl/interfaceProperty.txt b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl/interfaceProperty.txt new file mode 100644 index 00000000000..e7268134d1a --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl/interfaceProperty.txt @@ -0,0 +1,14 @@ +@kotlin.Metadata +public interface Deprecated { + // source: 'interfaceProperty.kt' + public synthetic deprecated static @Foo method getProp$annotations(): void + public abstract @org.jetbrains.annotations.NotNull method getProp(): java.lang.String +} + +@kotlin.annotation.Target +@java.lang.annotation.Retention +@java.lang.annotation.Target +@kotlin.Metadata +public annotation class Foo { + // source: 'interfaceProperty.kt' +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index c35ca3e269b..16237ab2f62 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -6836,6 +6836,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop") @TestDataPath("$PROJECT_ROOT") public class Interop { + @Test + @TestMetadata("allAgainsAllCompatibility.kt") + public void testAllAgainsAllCompatibility() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allAgainsAllCompatibility.kt"); + } + + @Test + @TestMetadata("allCompatibilityAgainsAll.kt") + public void testAllCompatibilityAgainsAll() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allCompatibilityAgainsAll.kt"); + } + @Test public void testAllFilesPresentInInterop() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); @@ -6883,6 +6895,22 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/newSchemeWithJvmDefault.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + public class NoDefaultImpls { + @Test + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("superPropAccessFromInterface.kt") + public void testSuperPropAccessFromInterface() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls/superPropAccessFromInterface.kt"); + } + } } @Nested diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index f004c5693aa..b278e98f190 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -6836,6 +6836,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop") @TestDataPath("$PROJECT_ROOT") public class Interop { + @Test + @TestMetadata("allAgainsAllCompatibility.kt") + public void testAllAgainsAllCompatibility() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allAgainsAllCompatibility.kt"); + } + + @Test + @TestMetadata("allCompatibilityAgainsAll.kt") + public void testAllCompatibilityAgainsAll() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allCompatibilityAgainsAll.kt"); + } + @Test public void testAllFilesPresentInInterop() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); @@ -6883,6 +6895,22 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/newSchemeWithJvmDefault.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + public class NoDefaultImpls { + @Test + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("superPropAccessFromInterface.kt") + public void testSuperPropAccessFromInterface() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls/superPropAccessFromInterface.kt"); + } + } } @Nested diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxTestGenerated.java index 02fc861b0c5..b6e1dff8c0b 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxTestGenerated.java @@ -749,6 +749,18 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop") @TestDataPath("$PROJECT_ROOT") public class Interop { + @Test + @TestMetadata("allAgainsAllCompatibility.kt") + public void testAllAgainsAllCompatibility() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allAgainsAllCompatibility.kt"); + } + + @Test + @TestMetadata("allCompatibilityAgainsAll.kt") + public void testAllCompatibilityAgainsAll() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allCompatibilityAgainsAll.kt"); + } + @Test public void testAllFilesPresentInInterop() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); @@ -796,6 +808,22 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/newSchemeWithJvmDefault.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + public class NoDefaultImpls { + @Test + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true); + } + + @Test + @TestMetadata("superPropAccessFromInterface.kt") + public void testSuperPropAccessFromInterface() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls/superPropAccessFromInterface.kt"); + } + } } @Nested diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxTestGenerated.java index 42b5144e7a8..581cb649990 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxTestGenerated.java @@ -749,6 +749,18 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop") @TestDataPath("$PROJECT_ROOT") public class Interop { + @Test + @TestMetadata("allAgainsAllCompatibility.kt") + public void testAllAgainsAllCompatibility() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allAgainsAllCompatibility.kt"); + } + + @Test + @TestMetadata("allCompatibilityAgainsAll.kt") + public void testAllCompatibilityAgainsAll() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allCompatibilityAgainsAll.kt"); + } + @Test public void testAllFilesPresentInInterop() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); @@ -796,6 +808,22 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/newSchemeWithJvmDefault.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + public class NoDefaultImpls { + @Test + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true); + } + + @Test + @TestMetadata("superPropAccessFromInterface.kt") + public void testSuperPropAccessFromInterface() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls/superPropAccessFromInterface.kt"); + } + } } @Nested diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 9bbc74d2da6..e39035abf8c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -1441,6 +1441,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/deprecationWithDefault.kt"); } + @TestMetadata("interfaceProperty.kt") + public void testInterfaceProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/interfaceProperty.kt"); + } + @TestMetadata("jvmDefaultWithoutCompatibility.kt") public void testJvmDefaultWithoutCompatibility() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/jvmDefaultWithoutCompatibility.kt"); @@ -1474,6 +1479,42 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { } } } + + @TestMetadata("compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Enable extends AbstractBytecodeListingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInEnable() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("interfaceProperty.kt") + public void testInterfaceProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable/interfaceProperty.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NoDefaultImpl extends AbstractBytecodeListingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInNoDefaultImpl() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("interfaceProperty.kt") + public void testInterfaceProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl/interfaceProperty.kt"); + } + } } } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 3c3bc80545c..dd7a19aa556 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -1441,6 +1441,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/deprecationWithDefault.kt"); } + @TestMetadata("interfaceProperty.kt") + public void testInterfaceProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/interfaceProperty.kt"); + } + @TestMetadata("jvmDefaultWithoutCompatibility.kt") public void testJvmDefaultWithoutCompatibility() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/jvmDefaultWithoutCompatibility.kt"); @@ -1474,6 +1479,42 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes } } } + + @TestMetadata("compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Enable extends AbstractIrBytecodeListingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInEnable() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("interfaceProperty.kt") + public void testInterfaceProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvm8/defaults/enable/interfaceProperty.kt"); + } + } + + @TestMetadata("compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NoDefaultImpl extends AbstractIrBytecodeListingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInNoDefaultImpl() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("interfaceProperty.kt") + public void testInterfaceProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/jvm8/defaults/noDefaultImpl/interfaceProperty.kt"); + } + } } } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index e69f4de9409..6ea02ceed1d 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -4561,6 +4561,16 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); } + @TestMetadata("allAgainsAllCompatibility.kt") + public void testAllAgainsAllCompatibility() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allAgainsAllCompatibility.kt"); + } + + @TestMetadata("allCompatibilityAgainsAll.kt") + public void testAllCompatibilityAgainsAll() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/allCompatibilityAgainsAll.kt"); + } + public void testAllFilesPresentInInterop() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } @@ -4600,6 +4610,24 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/interop/newSchemeWithJvmDefault.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NoDefaultImpls extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInNoDefaultImpls() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("superPropAccessFromInterface.kt") + public void testSuperPropAccessFromInterface() throws Exception { + runTest("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/defaults/noDefaultImpls/superPropAccessFromInterface.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/compileKotlinAgainstKotlin/jvm8/jvm8against6")