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 d33836b9b8c..b6d6b96e210 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 @@ -25795,6 +25795,42 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr public void testInlineClasInSignatureNullable() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt"); } + + @Test + @TestMetadata("kt55945.kt") + public void testKt55945() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/kt55945.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassDeclaredInJava.kt") + public void testMethodWithInlineClassDeclaredInJava() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJava.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt") + public void testMethodWithInlineClassDeclaredInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassInheritedBothFromJavaAndKotlin.kt") + public void testMethodWithInlineClassInheritedBothFromJavaAndKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedBothFromJavaAndKotlin.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt") + public void testMethodWithInlineClassInheritedInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("oldFunctionMangling.kt") + public void testOldFunctionMangling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/oldFunctionMangling.kt"); + } } @Nested @@ -52528,6 +52564,40 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr public void testVisibility() throws Exception { runTest("compiler/testData/codegen/box/valueClasses/visibility.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("methodWithValueClassDeclaredInJava.kt") + public void testMethodWithValueClassDeclaredInJava() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJava.kt"); + } + + @Test + @TestMetadata("methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt") + public void testMethodWithValueClassDeclaredInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("methodWithValueClassInheritedBothFromJavaAndKotlin.kt") + public void testMethodWithValueClassInheritedBothFromJavaAndKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedBothFromJavaAndKotlin.kt"); + } + + @Test + @TestMetadata("methodWithValueClassInheritedInJavaOverriddenInKotlin.kt") + public void testMethodWithValueClassInheritedInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedInJavaOverriddenInKotlin.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 f57ce7ffb3a..fc4f2788161 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 @@ -25795,6 +25795,42 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo public void testInlineClasInSignatureNullable() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt"); } + + @Test + @TestMetadata("kt55945.kt") + public void testKt55945() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/kt55945.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassDeclaredInJava.kt") + public void testMethodWithInlineClassDeclaredInJava() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJava.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt") + public void testMethodWithInlineClassDeclaredInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassInheritedBothFromJavaAndKotlin.kt") + public void testMethodWithInlineClassInheritedBothFromJavaAndKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedBothFromJavaAndKotlin.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt") + public void testMethodWithInlineClassInheritedInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("oldFunctionMangling.kt") + public void testOldFunctionMangling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/oldFunctionMangling.kt"); + } } @Nested @@ -52528,6 +52564,40 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo public void testVisibility() throws Exception { runTest("compiler/testData/codegen/box/valueClasses/visibility.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("methodWithValueClassDeclaredInJava.kt") + public void testMethodWithValueClassDeclaredInJava() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJava.kt"); + } + + @Test + @TestMetadata("methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt") + public void testMethodWithValueClassDeclaredInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("methodWithValueClassInheritedBothFromJavaAndKotlin.kt") + public void testMethodWithValueClassInheritedBothFromJavaAndKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedBothFromJavaAndKotlin.kt"); + } + + @Test + @TestMetadata("methodWithValueClassInheritedInJavaOverriddenInKotlin.kt") + public void testMethodWithValueClassInheritedInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedInJavaOverriddenInKotlin.kt"); + } + } } @Nested diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedInlineClassReplacements.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedInlineClassReplacements.kt index 274e2fc7921..feb56ebde36 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedInlineClassReplacements.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedInlineClassReplacements.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.backend.jvm.ir.extensionReceiverName import org.jetbrains.kotlin.backend.jvm.ir.isStaticValueClassReplacement import org.jetbrains.kotlin.backend.jvm.ir.parentClassId import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper +import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.IrBuiltIns @@ -36,6 +37,9 @@ class MemoizedInlineClassReplacements( val originalFunctionForStaticReplacement: MutableMap = ConcurrentHashMap() val originalFunctionForMethodReplacement: MutableMap = ConcurrentHashMap() + private val mangleCallsToJavaMethodsWithValueClasses = + context.state.languageVersionSettings.supportsFeature(LanguageFeature.MangleCallsToJavaMethodsWithValueClasses) + /** * Get a replacement for a function or a constructor. */ @@ -76,15 +80,20 @@ class MemoizedInlineClassReplacements( } // Otherwise, mangle functions with mangled parameters, ignoring constructors - it is IrSimpleFunction && !it.isFromJava() && - (it.hasMangledParameters(includeMFVC = false) || mangleReturnTypes && it.hasMangledReturnType) -> - createMethodReplacement(it) + it is IrSimpleFunction && it.needsReplacement -> createMethodReplacement(it) else -> null } } + private val IrSimpleFunction.needsReplacement: Boolean + get() { + if (!hasMangledParameters(includeMFVC = false) && !(mangleReturnTypes && hasMangledReturnType)) return false + if (isFromJava()) return mangleCallsToJavaMethodsWithValueClasses && !overridesOnlyMethodsFromJava() + return true + } + /** * Get the box function for an inline class. Concretely, this is a synthetic * static function named "box-impl" which takes an unboxed value and returns diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedMultiFieldValueClassReplacements.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedMultiFieldValueClassReplacements.kt index 23145babcb5..a7acf5b0c37 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedMultiFieldValueClassReplacements.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedMultiFieldValueClassReplacements.kt @@ -277,7 +277,10 @@ class MemoizedMultiFieldValueClassReplacements( createStaticReplacement(function) } - function is IrSimpleFunction && !function.isFromJava() && function.fullValueParameterList.any { it.type.needsMfvcFlattening() } && run { + function is IrSimpleFunction + && !(function.isFromJava() && function.overridesOnlyMethodsFromJava()) + && function.fullValueParameterList.any { it.type.needsMfvcFlattening() } + && run { if (!function.isFakeOverride) return@run true val superDeclaration = findSuperDeclaration(function, false, context.state.jvmDefaultMode) getReplacementFunction(superDeclaration) != null diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedValueClassAbstractReplacements.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedValueClassAbstractReplacements.kt index d0531c2df28..298a8015505 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedValueClassAbstractReplacements.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/MemoizedValueClassAbstractReplacements.kt @@ -137,4 +137,6 @@ abstract class MemoizedValueClassAbstractReplacements( getReplacementFunction(function) ?: function.also { function.overriddenSymbols = replaceOverriddenSymbols(function) } + + protected fun IrSimpleFunction.overridesOnlyMethodsFromJava(): Boolean = allOverridden().all { it.isFromJava() } } \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/javaInterop/kt55945.kt b/compiler/testData/codegen/box/inlineClasses/javaInterop/kt55945.kt new file mode 100644 index 00000000000..f94e6fb60a9 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/javaInterop/kt55945.kt @@ -0,0 +1,22 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR +// LANGUAGE: +MangleCallsToJavaMethodsWithValueClasses + + +// FILE: KotlinParent.kt +open class KotlinParent { + fun foo(type: InlineType) = 42 + + @JvmInline + value class InlineType(val id: Int) +} + +// FILE: JavaChild.java +class JavaChild extends KotlinParent {} + + +// FILE: box.kt +fun box(): String { + if (JavaChild().foo(KotlinParent.InlineType(1)) != 42) return "Fail" + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJava.kt b/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJava.kt new file mode 100644 index 00000000000..7962a2b4d01 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJava.kt @@ -0,0 +1,31 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR + +// FILE: JavaBase.java + +import kotlin.UInt; + +public class JavaBase { + public int foo(UInt x) + { + return 42; + } +} + +// FILE: JavaChild.java + +public class JavaChild extends JavaBase {} + +// FILE: KotlinChild.kt + +class KotlinChild : JavaChild() + +// FILE: box.kt + +fun box(): String { + if (JavaBase().foo(0.toUInt()) != 42) return "Fail 1" + if (JavaChild().foo(0.toUInt()) != 42) return "Fail 2" + if (KotlinChild().foo(0.toUInt()) != 42) return "Fail 3" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt b/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt new file mode 100644 index 00000000000..9903da49898 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt @@ -0,0 +1,34 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR + + +// FILE: JavaBase.java + +import kotlin.UInt; + +public class JavaBase { + public int foo(UInt x) + { + return 42; + } +} + +// FILE: JavaChild.java + +public class JavaChild extends JavaBase {} + +// FILE: KotlinChild.kt + +class KotlinChild : JavaChild() { + override fun foo(x : UInt) = 24 +} + +// FILE: box.kt + +fun box(): String { + if (JavaBase().foo(0.toUInt()) != 42) return "Fail 1" + if (JavaChild().foo(0.toUInt()) != 42) return "Fail 2" + if (KotlinChild().foo(0.toUInt()) != 24) return "Fail 3" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedBothFromJavaAndKotlin.kt b/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedBothFromJavaAndKotlin.kt new file mode 100644 index 00000000000..c38ee7f951c --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedBothFromJavaAndKotlin.kt @@ -0,0 +1,34 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR + + +// FILE: KotlinInterface.kt + +public interface KotlinInterface { + fun foo(x: UInt): Int +} + +// FILE: JavaInterface.java + +import kotlin.UInt; + +public interface JavaInterface { + int foo(UInt x); +} + +// FILE: JavaInterfaceChildOfKotlin.java + +public interface JavaInterfaceChildOfKotlin extends KotlinInterface {} + +// FILE: KotlinChild.kt + +class KotlinChild : JavaInterface, JavaInterfaceChildOfKotlin { + override fun foo(x: UInt) = 42 +} + +// FILE: box.kt + +fun box(): String { + if (KotlinChild().foo(0.toUInt()) != 42) return "Fail" + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt b/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt new file mode 100644 index 00000000000..dd3ae835e9f --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt @@ -0,0 +1,28 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR + +// FILE: KotlinBase.kt + +open class KotlinBase { + open fun foo(x : UInt) = 42 +} + +// FILE: JavaChild.java + +public class JavaChild extends KotlinBase {} + +// FILE: KotlinChild.kt + +class KotlinChild : JavaChild() { + override fun foo(x : UInt) = 24 +} + +// FILE: box.kt + +fun box(): String { + if (KotlinBase().foo(0.toUInt()) != 42) return "Fail 1" + if (JavaChild().foo(0.toUInt()) != 42) return "Fail 2" + if (KotlinChild().foo(0.toUInt()) != 24) return "Fail 3" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/javaInterop/oldFunctionMangling.kt b/compiler/testData/codegen/box/inlineClasses/javaInterop/oldFunctionMangling.kt new file mode 100644 index 00000000000..132d4827b69 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/javaInterop/oldFunctionMangling.kt @@ -0,0 +1,24 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR +// LANGUAGE: -MangleCallsToJavaMethodsWithValueClasses + +// FILE: KotlinParent.kt + +open class KotlinParent { + fun foo(x: UInt) = x.toInt() +} + +// FILE: JavaChild.java + +public class JavaChild extends KotlinParent { + public int foo(int x) { + return 42; + } +} + +// FILE: box.kt + +fun box(): String { + if (JavaChild().foo(0.toUInt()) != 42) return "Fail" + return "OK" +} diff --git a/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJava.kt b/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJava.kt new file mode 100644 index 00000000000..52634aa6379 --- /dev/null +++ b/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJava.kt @@ -0,0 +1,35 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR +// LANGUAGE: +ValueClasses + +// FILE: Point.kt + +@JvmInline +value class Point(val x: Int, val y: Int) + +// FILE: JavaBase.java + +public class JavaBase { + public int foo(Point x) + { + return 42; + } +} + +// FILE: JavaChild.java + +public class JavaChild extends JavaBase {} + +// FILE: KotlinChild.kt + +class KotlinChild : JavaChild() + +// FILE: box.kt + +fun box(): String { + if (JavaBase().foo(Point(0, 0)) != 42) return "Fail 1" + if (JavaChild().foo(Point(0, 0)) != 42) return "Fail 2" + if (KotlinChild().foo(Point(0, 0)) != 42) return "Fail 3" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt b/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt new file mode 100644 index 00000000000..466c1968d5f --- /dev/null +++ b/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt @@ -0,0 +1,37 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR +// LANGUAGE: +ValueClasses + +// FILE: Point.kt + +@JvmInline +value class Point(val x: Int, val y: Int) + +// FILE: JavaBase.java + +public class JavaBase { + public int foo(Point x) + { + return 42; + } +} + +// FILE: JavaChild.java + +public class JavaChild extends JavaBase {} + +// FILE: KotlinChild.kt + +class KotlinChild : JavaChild() { + override fun foo(x : Point) = 24 +} + +// FILE: box.kt + +fun box(): String { + if (JavaBase().foo(Point(0, 0)) != 42) return "Fail 1" + if (JavaChild().foo(Point(0, 0)) != 42) return "Fail 2" + if (KotlinChild().foo(Point(0, 0)) != 24) return "Fail 3" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedBothFromJavaAndKotlin.kt b/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedBothFromJavaAndKotlin.kt new file mode 100644 index 00000000000..ad21f7b082c --- /dev/null +++ b/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedBothFromJavaAndKotlin.kt @@ -0,0 +1,37 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR +// LANGUAGE: +ValueClasses + +// FILE: Point.kt + +@JvmInline +value class Point(val x: Int, val y: Int) + +// FILE: KotlinInterface.kt + +public interface KotlinInterface { + fun foo(x: Point): Int +} + +// FILE: JavaInterface.java + +public interface JavaInterface { + int foo(Point x); +} + +// FILE: JavaInterfaceChildOfKotlin.java + +public interface JavaInterfaceChildOfKotlin extends KotlinInterface {} + +// FILE: KotlinChild.kt + +class KotlinChild : JavaInterface, JavaInterfaceChildOfKotlin { + override fun foo(x: Point) = 42 +} + +// FILE: box.kt + +fun box(): String { + if (KotlinChild().foo(Point(0, 0)) != 42) return "Fail" + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedInJavaOverriddenInKotlin.kt b/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedInJavaOverriddenInKotlin.kt new file mode 100644 index 00000000000..46211900694 --- /dev/null +++ b/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedInJavaOverriddenInKotlin.kt @@ -0,0 +1,34 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR +// LANGUAGE: +ValueClasses + +// FILE: Point.kt + +@JvmInline +value class Point(val x: Int, val y: Int) + +// FILE: KotlinBase.kt + +open class KotlinBase { + open fun foo(x : Point) = 42 +} + +// FILE: JavaChild.java + +public class JavaChild extends KotlinBase {} + +// FILE: KotlinChild.kt + +class KotlinChild : JavaChild() { + override fun foo(x : Point) = 24 +} + +// FILE: box.kt + +fun box(): String { + if (KotlinBase().foo(Point(0, 0)) != 42) return "Fail 1" + if (JavaChild().foo(Point(0, 0)) != 42) return "Fail 2" + if (KotlinChild().foo(Point(0, 0)) != 24) return "Fail 3" + + return "OK" +} \ No newline at end of file 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 31c94488a66..61d84223c15 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 @@ -49552,6 +49552,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + } } @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 8b192342867..f43a3d903cb 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 @@ -25795,6 +25795,42 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testInlineClasInSignatureNullable() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt"); } + + @Test + @TestMetadata("kt55945.kt") + public void testKt55945() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/kt55945.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassDeclaredInJava.kt") + public void testMethodWithInlineClassDeclaredInJava() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJava.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt") + public void testMethodWithInlineClassDeclaredInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassInheritedBothFromJavaAndKotlin.kt") + public void testMethodWithInlineClassInheritedBothFromJavaAndKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedBothFromJavaAndKotlin.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt") + public void testMethodWithInlineClassInheritedInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("oldFunctionMangling.kt") + public void testOldFunctionMangling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/oldFunctionMangling.kt"); + } } @Nested @@ -52528,6 +52564,40 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testVisibility() throws Exception { runTest("compiler/testData/codegen/box/valueClasses/visibility.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("methodWithValueClassDeclaredInJava.kt") + public void testMethodWithValueClassDeclaredInJava() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJava.kt"); + } + + @Test + @TestMetadata("methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt") + public void testMethodWithValueClassDeclaredInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("methodWithValueClassInheritedBothFromJavaAndKotlin.kt") + public void testMethodWithValueClassInheritedBothFromJavaAndKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedBothFromJavaAndKotlin.kt"); + } + + @Test + @TestMetadata("methodWithValueClassInheritedInJavaOverriddenInKotlin.kt") + public void testMethodWithValueClassInheritedInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedInJavaOverriddenInKotlin.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 f06f09479e6..180f1f1c292 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 @@ -25795,6 +25795,42 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack public void testInlineClasInSignatureNullable() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt"); } + + @Test + @TestMetadata("kt55945.kt") + public void testKt55945() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/kt55945.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassDeclaredInJava.kt") + public void testMethodWithInlineClassDeclaredInJava() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJava.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt") + public void testMethodWithInlineClassDeclaredInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassInheritedBothFromJavaAndKotlin.kt") + public void testMethodWithInlineClassInheritedBothFromJavaAndKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedBothFromJavaAndKotlin.kt"); + } + + @Test + @TestMetadata("methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt") + public void testMethodWithInlineClassInheritedInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("oldFunctionMangling.kt") + public void testOldFunctionMangling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/oldFunctionMangling.kt"); + } } @Nested @@ -52528,6 +52564,40 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack public void testVisibility() throws Exception { runTest("compiler/testData/codegen/box/valueClasses/visibility.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("methodWithValueClassDeclaredInJava.kt") + public void testMethodWithValueClassDeclaredInJava() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJava.kt"); + } + + @Test + @TestMetadata("methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt") + public void testMethodWithValueClassDeclaredInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt"); + } + + @Test + @TestMetadata("methodWithValueClassInheritedBothFromJavaAndKotlin.kt") + public void testMethodWithValueClassInheritedBothFromJavaAndKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedBothFromJavaAndKotlin.kt"); + } + + @Test + @TestMetadata("methodWithValueClassInheritedInJavaOverriddenInKotlin.kt") + public void testMethodWithValueClassInheritedInJavaOverriddenInKotlin() throws Exception { + runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedInJavaOverriddenInKotlin.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 a32121dab4b..259b6502360 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -40374,6 +40374,19 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaInterop extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + } } @TestMetadata("compiler/testData/codegen/box/vararg") diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index ce1cb87906e..e51216c6792 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -291,6 +291,7 @@ enum class LanguageFeature( ProhibitAccessToInvisibleSetterFromDerivedClass(KOTLIN_2_0, kind = BUG_FIX), // KT-56662 ProhibitOpenValDeferredInitialization(KOTLIN_2_0, kind = BUG_FIX), // KT-57553 ProhibitMissedMustBeInitializedWhenThereIsNoPrimaryConstructor(KOTLIN_2_0, kind = BUG_FIX), // KT-58472 + MangleCallsToJavaMethodsWithValueClasses(KOTLIN_2_0, kind = OTHER), // KT-55945 // 2.1 diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index 6f9d038be67..78697653f32 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -36562,6 +36562,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + } } @Nested 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 11a67b3fd40..9a7a96352f3 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 @@ -36988,6 +36988,16 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, 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 13778886fa2..e709ceee2de 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 @@ -36988,6 +36988,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), 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 a9e747a9162..3571dc8ef18 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 @@ -36988,6 +36988,16 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java index bc888712715..f2502792f61 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java @@ -40630,6 +40630,19 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java index 1b300d87b00..1c3e4ce929e 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java @@ -41656,6 +41656,21 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index afe30d055fe..e79eb8edaa7 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -40118,6 +40118,18 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + @DisabledTestsIfProperty(sourceLocations = { "compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt", "compiler/testData/codegen/box/multiplatform/defaultArguments/*.kt", "compiler/testData/codegen/box/multiplatform/migratedOldTests/*.kt", "compiler/testData/codegen/boxInline/multiplatform/defaultArguments/receiversAndParametersInLambda.kt" }, property = ClassLevelProperty.TEST_MODE, propertyValue = "ONE_STAGE_MULTI_MODULE") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java index 84396962374..fbd11032a6a 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java @@ -40631,6 +40631,19 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class JavaInterop { + @Test + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java index 4d21b09d183..c9820b99a0b 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java @@ -33044,6 +33044,19 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + + @TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaInterop extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInJavaInterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } } @TestMetadata("compiler/testData/codegen/box/vararg")