Fix function invocation mangling rule

Mangle invocations of functions with value classes in signature which
override (directly or indirectly) a method declared in Kotlin code.
Otherwise, NoSuchMethodError is being thrown.

^KT-55945: Fixed
This commit is contained in:
vladislav.grechko
2023-02-07 20:59:30 +01:00
committed by Space Team
parent f80ed4592d
commit 457837a255
29 changed files with 744 additions and 4 deletions
@@ -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
@@ -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
@@ -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<IrFunction, IrFunction> = ConcurrentHashMap()
val originalFunctionForMethodReplacement: MutableMap<IrFunction, IrFunction> = 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
@@ -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
@@ -137,4 +137,6 @@ abstract class MemoizedValueClassAbstractReplacements(
getReplacementFunction(function) ?: function.also {
function.overriddenSymbols = replaceOverriddenSymbols(function)
}
protected fun IrSimpleFunction.overridesOnlyMethodsFromJava(): Boolean = allOverridden().all { it.isFromJava() }
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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
@@ -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
@@ -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
@@ -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")
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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")