From b2c30921e4a66a257a0f6310e3c0a7b1464c18fd Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 8 Sep 2023 17:50:00 +0200 Subject: [PATCH] JVM: support JVM-specific primitive/wrapper type overridability check #KT-62045 Fixed --- ...LFirBlackBoxCodegenBasedTestGenerated.java | 46 +++++++++++++ ...rsedBlackBoxCodegenBasedTestGenerated.java | 46 +++++++++++++ .../fir/backend/jvm/JvmFir2IrExtensions.kt | 5 +- ...LightTreeBlackBoxCodegenTestGenerated.java | 46 +++++++++++++ ...hIrFakeOverrideGeneratorTestGenerated.java | 46 +++++++++++++ .../FirPsiBlackBoxCodegenTestGenerated.java | 46 +++++++++++++ ...mpatibilityRulesOverridabilityCondition.kt | 64 +++++++++++++++++++ .../anotherKotlinClassInTheMiddle.kt | 36 +++++++++++ .../diamond.kt | 39 +++++++++++ .../double.kt | 33 ++++++++++ .../generic.kt | 33 ++++++++++ .../int.kt | 33 ++++++++++ .../nullableInt.kt | 37 +++++++++++ .../JvmAbiConsistencyTestBoxGenerated.java | 46 +++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 46 +++++++++++++ .../IrBlackBoxCodegenTestGenerated.java | 46 +++++++++++++ ...kBoxCodegenWithIrInlinerTestGenerated.java | 46 +++++++++++++ .../LightAnalysisModeTestGenerated.java | 43 +++++++++++++ .../fir/FirJsCodegenBoxTestGenerated.java | 10 +++ .../fir/FirJsES6CodegenBoxTestGenerated.java | 10 +++ .../test/ir/IrJsCodegenBoxTestGenerated.java | 10 +++ .../ir/IrJsES6CodegenBoxTestGenerated.java | 10 +++ .../FirNativeCodegenBoxTestGenerated.java | 13 ++++ .../FirNativeCodegenBoxTestNoPLGenerated.java | 15 +++++ .../NativeCodegenBoxTestGenerated.java | 11 ++++ .../NativeCodegenBoxTestNoPLGenerated.java | 13 ++++ .../test/FirWasmCodegenBoxTestGenerated.java | 10 +++ .../test/K1WasmCodegenBoxTestGenerated.java | 10 +++ 28 files changed, 848 insertions(+), 1 deletion(-) create mode 100644 compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/overrides/IrJavaIncompatibilityRulesOverridabilityCondition.kt create mode 100644 compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt create mode 100644 compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt create mode 100644 compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt create mode 100644 compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt create mode 100644 compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt create mode 100644 compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java index f8198f3c5e5..6ef6953e290 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java @@ -31655,6 +31655,52 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo runTest("compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("anotherKotlinClassInTheMiddle.kt") + public void testAnotherKotlinClassInTheMiddle() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt"); + } + + @Test + @TestMetadata("diamond.kt") + public void testDiamond() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt"); + } + + @Test + @TestMetadata("double.kt") + public void testDouble() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt"); + } + + @Test + @TestMetadata("generic.kt") + public void testGeneric() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt"); + } + + @Test + @TestMetadata("int.kt") + public void testInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt"); + } + + @Test + @TestMetadata("nullableInt.kt") + public void testNullableInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); + } + } } @Nested diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java index b976dd91643..3e80aad1d26 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java @@ -31655,6 +31655,52 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi runTest("compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("anotherKotlinClassInTheMiddle.kt") + public void testAnotherKotlinClassInTheMiddle() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt"); + } + + @Test + @TestMetadata("diamond.kt") + public void testDiamond() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt"); + } + + @Test + @TestMetadata("double.kt") + public void testDouble() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt"); + } + + @Test + @TestMetadata("generic.kt") + public void testGeneric() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt"); + } + + @Test + @TestMetadata("int.kt") + public void testInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt"); + } + + @Test + @TestMetadata("nullableInt.kt") + public void testNullableInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); + } + } } @Nested diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/JvmFir2IrExtensions.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/JvmFir2IrExtensions.kt index dc8e19239bc..000531fd155 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/JvmFir2IrExtensions.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/JvmFir2IrExtensions.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.backend.jvm import org.jetbrains.kotlin.backend.common.serialization.signature.PublicIdSignatureComputer import org.jetbrains.kotlin.backend.jvm.* +import org.jetbrains.kotlin.backend.jvm.overrides.IrJavaIncompatibilityRulesOverridabilityCondition import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.JVMConfigurationKeys import org.jetbrains.kotlin.config.JvmSerializeIrMode @@ -36,7 +37,9 @@ class JvmFir2IrExtensions( private val mangler: KotlinMangler.IrMangler, ) : Fir2IrExtensions, JvmGeneratorExtensions { override val parametersAreAssignable: Boolean get() = true - override val externalOverridabilityConditions: List = emptyList() // TODO: KT-61370 + override val externalOverridabilityConditions: List + get() = listOf(IrJavaIncompatibilityRulesOverridabilityCondition()) + override val classNameOverride: MutableMap = mutableMapOf() override val cachedFields = CachedFieldsForObjectInstances(IrFactoryImpl, configuration.languageVersionSettings) diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index b690dc053e5..75a95e3cfcd 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -31304,6 +31304,52 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("anotherKotlinClassInTheMiddle.kt") + public void testAnotherKotlinClassInTheMiddle() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt"); + } + + @Test + @TestMetadata("diamond.kt") + public void testDiamond() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt"); + } + + @Test + @TestMetadata("double.kt") + public void testDouble() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt"); + } + + @Test + @TestMetadata("generic.kt") + public void testGeneric() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt"); + } + + @Test + @TestMetadata("int.kt") + public void testInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt"); + } + + @Test + @TestMetadata("nullableInt.kt") + public void testNullableInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); + } + } } @Nested diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java index f18cc0d1eba..d54fed451c4 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java @@ -31304,6 +31304,52 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated runTest("compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("anotherKotlinClassInTheMiddle.kt") + public void testAnotherKotlinClassInTheMiddle() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt"); + } + + @Test + @TestMetadata("diamond.kt") + public void testDiamond() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt"); + } + + @Test + @TestMetadata("double.kt") + public void testDouble() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt"); + } + + @Test + @TestMetadata("generic.kt") + public void testGeneric() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt"); + } + + @Test + @TestMetadata("int.kt") + public void testInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt"); + } + + @Test + @TestMetadata("nullableInt.kt") + public void testNullableInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); + } + } } @Nested diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 303c7da385a..6945db63eec 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -31304,6 +31304,52 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("anotherKotlinClassInTheMiddle.kt") + public void testAnotherKotlinClassInTheMiddle() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt"); + } + + @Test + @TestMetadata("diamond.kt") + public void testDiamond() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt"); + } + + @Test + @TestMetadata("double.kt") + public void testDouble() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt"); + } + + @Test + @TestMetadata("generic.kt") + public void testGeneric() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt"); + } + + @Test + @TestMetadata("int.kt") + public void testInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt"); + } + + @Test + @TestMetadata("nullableInt.kt") + public void testNullableInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); + } + } } @Nested diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/overrides/IrJavaIncompatibilityRulesOverridabilityCondition.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/overrides/IrJavaIncompatibilityRulesOverridabilityCondition.kt new file mode 100644 index 00000000000..eeaa09d86a5 --- /dev/null +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/overrides/IrJavaIncompatibilityRulesOverridabilityCondition.kt @@ -0,0 +1,64 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.backend.jvm.overrides + +import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction +import org.jetbrains.kotlin.ir.overrides.IrExternalOverridabilityCondition +import org.jetbrains.kotlin.ir.overrides.IrExternalOverridabilityCondition.Contract +import org.jetbrains.kotlin.ir.overrides.IrExternalOverridabilityCondition.Result +import org.jetbrains.kotlin.ir.overrides.MemberWithOriginal +import org.jetbrains.kotlin.ir.types.getClass +import org.jetbrains.kotlin.ir.types.isPrimitiveType +import org.jetbrains.kotlin.ir.util.hasAnnotation +import org.jetbrains.kotlin.ir.util.isFromJava +import org.jetbrains.kotlin.ir.util.render +import org.jetbrains.kotlin.name.StandardClassIds + +class IrJavaIncompatibilityRulesOverridabilityCondition : IrExternalOverridabilityCondition { + override fun isOverridable( + superMember: MemberWithOriginal, + subMember: MemberWithOriginal, + ): Result { + if (doesJavaOverrideHaveIncompatibleValueParameterKinds(superMember, subMember)) { + return Result.INCOMPATIBLE + } + + return Result.UNKNOWN + } + + override val contract: Contract + get() = Contract.CONFLICTS_ONLY + + private fun doesJavaOverrideHaveIncompatibleValueParameterKinds( + superMember: MemberWithOriginal, + subMember: MemberWithOriginal, + ): Boolean { + val originalSuperMember = superMember.original as? IrSimpleFunction ?: return false + val originalSubMember = subMember.original as? IrSimpleFunction ?: return false + if (!originalSubMember.dispatchReceiverParameter!!.type.getClass()!!.isFromJava()) return false + require(originalSubMember.valueParameters.size == originalSuperMember.valueParameters.size) { + "External overridability condition with CONFLICTS_ONLY should not be run with different value parameters size: " + + "subMember=${originalSubMember.render()} superMember=${originalSuperMember.render()}" + } + + return originalSubMember.valueParameters.indices.any { i -> + isJvmParameterTypePrimitive(originalSuperMember, i) != isJvmParameterTypePrimitive(originalSubMember, i) + } + } + + private fun isJvmParameterTypePrimitive(function: IrSimpleFunction, index: Int): Boolean { + // K1's JavaIncompatibilityRulesOverridabilityCondition also performs some extra checks, which are missing here: + // 1) isPrimitiveCompareTo. This is not needed in case of IR fake overrides as long as we're not using IrFakeOverrideBuilder + // to build overrides for lazy IR, in particular for built-in classes (however this may change in KT-64352). + // 2) forceSingleValueParameterBoxing. This makes the only parameter of `remove(Int)` in a subclass of `MutableCollection` + // non-primitive. It's unclear what exactly it affects if overrides are built over IR. + // TODO (KT-65100): investigate whether forceSingleValueParameterBoxing is needed here and test properly. + + val type = function.valueParameters[index].type + return type.isPrimitiveType() && !type.hasAnnotation(StandardClassIds.Annotations.FlexibleNullability) + && !type.hasAnnotation(StandardClassIds.Annotations.EnhancedNullability) + } +} diff --git a/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt new file mode 100644 index 00000000000..11cd608a581 --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt @@ -0,0 +1,36 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// IGNORE_LIGHT_ANALYSIS +// FILE: box.kt +class E : D() + +fun box(): String = + E().foo(0) + +// FILE: A.java +public interface A { + default String foo(Integer value) { + return "Fail: A"; + } +} + +// FILE: K.kt +interface K : A + +// FILE: B.java +public abstract class B implements K { + public String foo(int value) { + return "OK"; + } +} + +// FILE: C.kt +open class C : B() + +// FILE: D.java +public class D extends C { + @Override + public String foo(Integer value) { + return "Fail: D"; + } +} diff --git a/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt new file mode 100644 index 00000000000..0e588c1cd0f --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt @@ -0,0 +1,39 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// IGNORE_LIGHT_ANALYSIS +// FILE: box.kt +class E : D() + +fun box(): String = + E().foo(0) + +// FILE: A.java +public interface A { + default String foo(Integer value) { + return "Fail: A"; + } +} + +// FILE: B.java +public interface B extends A { + default String foo(int value) { + return "OK"; + } +} + +// FILE: AImpl.java +public abstract class AImpl implements A {} + +// FILE: BImpl.java +public abstract class BImpl extends AImpl implements B {} + +// FILE: C.kt +open class C : BImpl() + +// FILE: D.java +public class D extends C { + @Override + public String foo(Integer value) { + return "Fail: D"; + } +} diff --git a/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt new file mode 100644 index 00000000000..4373ec98ae5 --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt @@ -0,0 +1,33 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// IGNORE_LIGHT_ANALYSIS +// FILE: box.kt +class E : D() + +fun box(): String = + E().foo(0.0) + +// FILE: A.java +public interface A { + default String foo(Double value) { + return "Fail: A"; + } +} + +// FILE: B.java +public abstract class B implements A { + public String foo(double value) { + return "OK"; + } +} + +// FILE: C.kt +open class C : B() + +// FILE: D.java +public class D extends C { + @Override + public String foo(Double value) { + return "Fail: D"; + } +} diff --git a/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt new file mode 100644 index 00000000000..c352d94b0ee --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt @@ -0,0 +1,33 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// IGNORE_LIGHT_ANALYSIS +// FILE: box.kt +class E : D() + +fun box(): String = + E().foo(0.0) + +// FILE: A.java +public interface A { + default String foo(T value) { + return "Fail: A"; + } +} + +// FILE: B.java +public abstract class B implements A { + public String foo(double value) { + return "OK"; + } +} + +// FILE: C.kt +open class C : B() + +// FILE: D.java +public class D extends C { + @Override + public String foo(Double value) { + return "Fail: D"; + } +} diff --git a/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt new file mode 100644 index 00000000000..7d735cb6da1 --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt @@ -0,0 +1,33 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// IGNORE_LIGHT_ANALYSIS +// FILE: box.kt +class E : D() + +fun box(): String = + E().foo(0) + +// FILE: A.java +public interface A { + default String foo(Integer value) { + return "Fail: A"; + } +} + +// FILE: B.java +public abstract class B implements A { + public String foo(int value) { + return "OK"; + } +} + +// FILE: C.kt +open class C : B() + +// FILE: D.java +public class D extends C { + @Override + public String foo(Integer value) { + return "Fail: D"; + } +} diff --git a/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt new file mode 100644 index 00000000000..978b5e15b15 --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt @@ -0,0 +1,37 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// IGNORE_LIGHT_ANALYSIS +// FILE: box.kt +class E : D() + +fun box(): String = + E().foo(0) + +// FILE: A.java +import org.jetbrains.annotations.Nullable; + +public interface A { + default String foo(@Nullable Integer value) { + return "Fail: A"; + } +} + +// FILE: B.java +public abstract class B implements A { + public String foo(int value) { + return "OK"; + } +} + +// FILE: C.kt +open class C : B() + +// FILE: D.java +import org.jetbrains.annotations.Nullable; + +public class D extends C { + @Override + public String foo(@Nullable Integer value) { + return "Fail: D"; + } +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java index b038f88b1e5..05fd7585724 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java @@ -31304,6 +31304,52 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency runTest("compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("anotherKotlinClassInTheMiddle.kt") + public void testAnotherKotlinClassInTheMiddle() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt"); + } + + @Test + @TestMetadata("diamond.kt") + public void testDiamond() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt"); + } + + @Test + @TestMetadata("double.kt") + public void testDouble() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt"); + } + + @Test + @TestMetadata("generic.kt") + public void testGeneric() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt"); + } + + @Test + @TestMetadata("int.kt") + public void testInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt"); + } + + @Test + @TestMetadata("nullableInt.kt") + public void testNullableInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); + } + } } @Nested 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 9a0aff06dc1..6a428853327 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 @@ -29576,6 +29576,52 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("anotherKotlinClassInTheMiddle.kt") + public void testAnotherKotlinClassInTheMiddle() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt"); + } + + @Test + @TestMetadata("diamond.kt") + public void testDiamond() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt"); + } + + @Test + @TestMetadata("double.kt") + public void testDouble() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt"); + } + + @Test + @TestMetadata("generic.kt") + public void testGeneric() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt"); + } + + @Test + @TestMetadata("int.kt") + public void testInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt"); + } + + @Test + @TestMetadata("nullableInt.kt") + public void testNullableInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.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 5ddd53dc171..22c99b9f527 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 @@ -31304,6 +31304,52 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("anotherKotlinClassInTheMiddle.kt") + public void testAnotherKotlinClassInTheMiddle() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt"); + } + + @Test + @TestMetadata("diamond.kt") + public void testDiamond() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt"); + } + + @Test + @TestMetadata("double.kt") + public void testDouble() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt"); + } + + @Test + @TestMetadata("generic.kt") + public void testGeneric() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt"); + } + + @Test + @TestMetadata("int.kt") + public void testInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt"); + } + + @Test + @TestMetadata("nullableInt.kt") + public void testNullableInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); + } + } } @Nested diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index e0903e59dac..ab901c995e8 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -31304,6 +31304,52 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("anotherKotlinClassInTheMiddle.kt") + public void testAnotherKotlinClassInTheMiddle() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt"); + } + + @Test + @TestMetadata("diamond.kt") + public void testDiamond() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt"); + } + + @Test + @TestMetadata("double.kt") + public void testDouble() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt"); + } + + @Test + @TestMetadata("generic.kt") + public void testGeneric() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt"); + } + + @Test + @TestMetadata("int.kt") + public void testInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt"); + } + + @Test + @TestMetadata("nullableInt.kt") + public void testNullableInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); + } + } } @Nested diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 6d09dfe3645..d7ce6bad193 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -26541,6 +26541,49 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class PrimitiveVsWrapperTypeInInheritance extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("anotherKotlinClassInTheMiddle.kt") + public void testAnotherKotlinClassInTheMiddle() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/anotherKotlinClassInTheMiddle.kt"); + } + + @TestMetadata("diamond.kt") + public void testDiamond() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/diamond.kt"); + } + + @TestMetadata("double.kt") + public void testDouble() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/double.kt"); + } + + @TestMetadata("generic.kt") + public void testGeneric() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/generic.kt"); + } + + @TestMetadata("int.kt") + public void testInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/int.kt"); + } + + @TestMetadata("nullableInt.kt") + public void testNullableInt() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/javaVisibility") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 18baa18b6ae..11000ac31f5 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -22910,6 +22910,16 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/objectMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } } @Nested diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java index f506e843c99..ac6cd7c067c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java @@ -22910,6 +22910,16 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/objectMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } } @Nested diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 7d518c0ebc9..04cf40c5575 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -22910,6 +22910,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/objectMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } } @Nested diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index 5e506a36a71..56b936c9b34 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -22910,6 +22910,16 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/objectMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java index 8413712259d..b71f80590e9 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java @@ -26407,6 +26407,19 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/objectMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java index 682bd69f64c..67572492085 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java @@ -26943,6 +26943,21 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/objectMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java index 7068548ede7..a0387a4996a 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java @@ -25871,6 +25871,17 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/objectMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java index 720122b00fc..87f725b2d86 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java @@ -26408,6 +26408,19 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/objectMethods"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java index 91bdc2e5a2d..20d39d38522 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java @@ -22898,6 +22898,16 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/objectMethods"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } } @Nested diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java index 9552cb0851f..89be49a68cc 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java @@ -22898,6 +22898,16 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/objectMethods"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance") + @TestDataPath("$PROJECT_ROOT") + public class PrimitiveVsWrapperTypeInInheritance { + @Test + public void testAllFilesPresentInPrimitiveVsWrapperTypeInInheritance() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } } @Nested