Experiment
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 be3eca1..68cb623 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
@@ -33523,6 +33523,12 @@
     }
 
     @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
+    @Test
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
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 3e7a61a..42116e5 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
@@ -33523,6 +33523,12 @@
     }
 
     @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
+    @Test
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt
index 2623a7d..ed6d821 100644
--- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt
+++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt
@@ -9,6 +9,7 @@
 import org.jetbrains.kotlin.fir.backend.*
 import org.jetbrains.kotlin.fir.declarations.*
 import org.jetbrains.kotlin.fir.declarations.utils.*
+import org.jetbrains.kotlin.fir.java.symbols.FirJavaOverriddenSyntheticPropertySymbol
 import org.jetbrains.kotlin.fir.resolve.*
 import org.jetbrains.kotlin.fir.scopes.*
 import org.jetbrains.kotlin.fir.scopes.impl.FirFakeOverrideGenerator
@@ -300,6 +301,10 @@
         directOverridden: FirTypeScope.(S) -> List<S>,
         processOverridden: FirTypeScope.(S, (S) -> ProcessorAction) -> ProcessorAction
     ): List<Pair<S, ConeClassLikeLookupTag>> {
+        val originalKotlinProperty = (originalSymbol as? FirJavaOverriddenSyntheticPropertySymbol)?.overriddenKotlinProperty
+        if (originalKotlinProperty != null) {
+            return listOf(originalKotlinProperty as S to originalKotlinProperty.containingClassLookupTag()!!)
+        }
         val scope = klass.unsubstitutedScope()
         val classLookupTag = klass.symbol.toLookupTag()
         val overriddenFirSymbols = computeBaseSymbols(originalSymbol, directOverridden, scope, classLookupTag)
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 bce404c..f265bd2 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
@@ -33392,6 +33392,12 @@
     }
 
     @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
+    @Test
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithFir2IrFakeOverrideGeneratorTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithFir2IrFakeOverrideGeneratorTestGenerated.java
index ce60b8a..fd27bfa 100644
--- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithFir2IrFakeOverrideGeneratorTestGenerated.java
+++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithFir2IrFakeOverrideGeneratorTestGenerated.java
@@ -33392,6 +33392,12 @@
     }
 
     @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
+    @Test
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
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 e051bf4..83c315c 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
@@ -33392,6 +33392,12 @@
     }
 
     @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
+    @Test
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaScopeProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaScopeProvider.kt
index bf1dc6d..0df4a3d 100644
--- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaScopeProvider.kt
+++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaScopeProvider.kt
@@ -10,9 +10,8 @@
 import org.jetbrains.kotlin.fir.declarations.FirClass
 import org.jetbrains.kotlin.fir.declarations.FirRegularClass
 import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
-import org.jetbrains.kotlin.fir.declarations.utils.classId
-import org.jetbrains.kotlin.fir.declarations.utils.isJava
-import org.jetbrains.kotlin.fir.declarations.utils.superConeTypes
+import org.jetbrains.kotlin.fir.declarations.FirTypeAlias
+import org.jetbrains.kotlin.fir.declarations.utils.*
 import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
 import org.jetbrains.kotlin.fir.java.scopes.*
 import org.jetbrains.kotlin.fir.resolve.*
@@ -23,6 +22,9 @@
 import org.jetbrains.kotlin.fir.scopes.impl.*
 import org.jetbrains.kotlin.fir.scopes.scopeForSupertype
 import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
+import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
+import org.jetbrains.kotlin.fir.types.ConeClassLikeType
+import org.jetbrains.kotlin.fir.types.coneTypeSafe
 import org.jetbrains.kotlin.fir.types.constructClassLikeType
 import org.jetbrains.kotlin.fir.types.isAny
 import org.jetbrains.kotlin.name.StandardClassIds
@@ -97,7 +99,29 @@
                 listOf(StandardClassIds.Any.constructClassLikeType(emptyArray(), isNullable = false))
             else
                 lookupSuperTypes(
-                    regularClass, lookupInterfaces = true, deep = false, useSiteSession = useSiteSession, substituteTypes = true
+                    regularClass,
+                    lookupInterfaces = true,
+                    deep = false,
+                    useSiteSession = useSiteSession,
+                    substituteTypes = true,
+                    supertypeSupplier = object : SupertypeSupplier() {
+                        override fun forClass(firClass: FirClass, useSiteSession: FirSession): List<ConeClassLikeType> {
+                            if (!firClass.isLocal) {
+                                // for local classes the phase may not be updated till that moment
+                                firClass.lazyResolveToPhase(FirResolvePhase.SUPER_TYPES)
+                            }
+                            if (firClass is FirJavaClass) {
+                                return firClass.mySuperTypeRefs.mapNotNull { it.coneTypeSafe() }
+                            }
+                            return firClass.superConeTypes
+                        }
+
+                        override fun expansionForTypeAlias(typeAlias: FirTypeAlias, useSiteSession: FirSession): ConeClassLikeType? {
+                            typeAlias.lazyResolveToPhase(FirResolvePhase.SUPER_TYPES)
+                            return typeAlias.expandedConeType
+                        }
+
+                    }
                 )
 
             val superTypeScopes = superTypes.mapNotNull {
diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt
index 53ac057..3086b22 100644
--- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt
+++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt
@@ -36,7 +36,7 @@
 
 enum class FirJavaTypeConversionMode {
     DEFAULT, ANNOTATION_MEMBER, ANNOTATION_CONSTRUCTOR_PARAMETER, SUPERTYPE,
-    TYPE_PARAMETER_BOUND_FIRST_ROUND, TYPE_PARAMETER_BOUND_AFTER_FIRST_ROUND;
+    TYPE_PARAMETER_BOUND_FIRST_ROUND, TYPE_PARAMETER_BOUND_AFTER_FIRST_ROUND, MY_MODE;
 
     val insideAnnotation: Boolean get() = this == ANNOTATION_MEMBER || this == ANNOTATION_CONSTRUCTOR_PARAMETER
 }
@@ -68,7 +68,7 @@
 ): FirResolvedTypeRef {
     return buildResolvedTypeRef {
         type = toConeKotlinType(session, javaTypeParameterStack, mode)
-            .let { if (mode == FirJavaTypeConversionMode.SUPERTYPE) it.lowerBoundIfFlexible() else it }
+            .let { if (mode == FirJavaTypeConversionMode.SUPERTYPE || mode == FirJavaTypeConversionMode.MY_MODE) it.lowerBoundIfFlexible() else it }
         annotations += type.attributes.customAnnotations
     }
 }
@@ -181,7 +181,11 @@
             var classId = if (mode.insideAnnotation) {
                 JavaToKotlinClassMap.mapJavaToKotlinIncludingClassMapping(classifier.fqName!!)
             } else {
-                JavaToKotlinClassMap.mapJavaToKotlin(classifier.fqName!!)
+                if (mode == FirJavaTypeConversionMode.MY_MODE) {
+                    JavaToKotlinClassMap.mapJavaToKotlin(classifier.fqName!!)
+                } else {
+                    JavaToKotlinClassMap.mapJavaToKotlin(classifier.fqName!!)
+                }
             } ?: classifier.classId!!
 
             if (lowerBound == null || argumentsMakeSenseOnlyForMutableContainer(classId, session)) {
diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaClass.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaClass.kt
index f749aed..4639f59 100644
--- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaClass.kt
+++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaClass.kt
@@ -74,6 +74,11 @@
         enhancement.enhanceSuperTypes(unenhnancedSuperTypes)
     }
 
+    val mySuperTypeRefs: List<FirTypeRef> by lazy {
+        val enhancement = FirSignatureEnhancement(this@FirJavaClass, moduleData.session, overridden = { emptyList() })
+        enhancement.myEnhanceSuperTypes(unenhnancedSuperTypes)
+    }
+
     // TODO: the lazy annotations is a workaround for KT-55387, some non-lazy solution should probably be used instead
     override val annotations: List<FirAnnotation> by lazy {
         unEnhancedAnnotations.convertAnnotationsToFir(moduleData.session, isDeprecatedInJavaDoc)
diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/SignatureEnhancement.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/SignatureEnhancement.kt
index 93fb6d3..4e56937 100644
--- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/SignatureEnhancement.kt
+++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/SignatureEnhancement.kt
@@ -27,7 +27,10 @@
 import org.jetbrains.kotlin.fir.expressions.unexpandedClassId
 import org.jetbrains.kotlin.fir.java.FirJavaTypeConversionMode
 import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack
-import org.jetbrains.kotlin.fir.java.declarations.*
+import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
+import org.jetbrains.kotlin.fir.java.declarations.FirJavaExternalAnnotation
+import org.jetbrains.kotlin.fir.java.declarations.FirJavaField
+import org.jetbrains.kotlin.fir.java.declarations.buildJavaField
 import org.jetbrains.kotlin.fir.java.resolveIfJavaType
 import org.jetbrains.kotlin.fir.java.symbols.FirJavaOverriddenSyntheticPropertySymbol
 import org.jetbrains.kotlin.fir.java.toConeKotlinTypeProbablyFlexible
@@ -557,6 +560,21 @@
         }
     }
 
+    fun myEnhanceSuperTypes(unenhnancedSuperTypes: List<FirTypeRef>): List<FirTypeRef> {
+        val purelyImplementedSupertype = getPurelyImplementedSupertype(moduleData.session)
+        val purelyImplementedSupertypeClassId = purelyImplementedSupertype?.classId
+        return buildList {
+            unenhnancedSuperTypes.mapNotNullTo(this) { superType ->
+                myEnhanceSuperType(superType).takeUnless {
+                    purelyImplementedSupertypeClassId != null && it.coneType.classId == purelyImplementedSupertypeClassId
+                }
+            }
+            purelyImplementedSupertype?.let {
+                add(buildResolvedTypeRef { type = it })
+            }
+        }
+    }
+
     private fun getPurelyImplementedSupertype(session: FirSession): ConeKotlinType? {
         val purelyImplementedClassIdFromAnnotation = owner.annotations
             .firstOrNull { it.unexpandedClassId?.asSingleFqName() == JvmAnnotationNames.PURELY_IMPLEMENTS_ANNOTATION }
@@ -594,6 +612,12 @@
             AnnotationQualifierApplicabilityType.TYPE_USE, contextQualifiers
         ).enhance(type, emptyList(), FirJavaTypeConversionMode.SUPERTYPE)
 
+    private fun myEnhanceSuperType(type: FirTypeRef): FirTypeRef =
+        EnhancementSignatureParts(
+            session, typeQualifierResolver, null, isCovariant = false, forceOnlyHeadTypeConstructor = false,
+            AnnotationQualifierApplicabilityType.TYPE_USE, contextQualifiers
+        ).enhance(type, emptyList(), FirJavaTypeConversionMode.MY_MODE)
+
     // ================================================================================================
 
     private fun enhanceReceiverType(
diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt
index 46945b9..b4313a5 100644
--- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt
+++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt
@@ -102,7 +102,8 @@
             name = property.name
             symbol = FirJavaOverriddenSyntheticPropertySymbol(
                 getterId = getterSymbol.callableId,
-                propertyId = CallableId(getterSymbol.callableId.packageName, getterSymbol.callableId.className, property.name)
+                propertyId = CallableId(getterSymbol.callableId.packageName, getterSymbol.callableId.className, property.name),
+                overriddenKotlinProperty = property.originalForSubstitutionOverride?.symbol ?: property.symbol
             )
             delegateGetter = getterSymbol.fir
             delegateSetter = setterSymbol?.fir
diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/symbols/FirJavaOverriddenSyntheticPropertySymbol.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/symbols/FirJavaOverriddenSyntheticPropertySymbol.kt
index f7612bb..43eaf9d 100644
--- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/symbols/FirJavaOverriddenSyntheticPropertySymbol.kt
+++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/symbols/FirJavaOverriddenSyntheticPropertySymbol.kt
@@ -5,6 +5,7 @@
 
 package org.jetbrains.kotlin.fir.java.symbols
 
+import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
 import org.jetbrains.kotlin.fir.symbols.impl.FirSyntheticPropertySymbol
 import org.jetbrains.kotlin.name.CallableId
 
@@ -43,7 +44,8 @@
  */
 class FirJavaOverriddenSyntheticPropertySymbol(
     propertyId: CallableId,
-    getterId: CallableId
+    getterId: CallableId,
+    val overriddenKotlinProperty: FirPropertySymbol? = null
 ) : FirSyntheticPropertySymbol(propertyId, getterId) {
     override fun copy(): FirSyntheticPropertySymbol = FirJavaOverriddenSyntheticPropertySymbol(callableId, getterId)
 }
\ No newline at end of file
diff --git a/compiler/testData/codegen/box/javaInterop/kt62570.kt b/compiler/testData/codegen/box/javaInterop/kt62570.kt
new file mode 100644
index 0000000..e182305
--- /dev/null
+++ b/compiler/testData/codegen/box/javaInterop/kt62570.kt
@@ -0,0 +1,53 @@
+// WITH_STDLIB
+
+// FILE: A.java
+
+public class A {
+    public int size()
+    { return 1; }
+}
+
+// FILE: JavaSet.java
+
+import java.util.*;
+
+public class JavaSet<T> extends A implements Set<T> {
+    public Iterator < T > iterator () { return null; }
+
+    public boolean isEmpty() { return false; }
+
+    public boolean contains(Object o) { return false; }
+
+    public Object [] toArray () { return new Object [1]; }
+
+    public<T> T [] toArray (T[] a) { throw new RuntimeException (); }
+
+    public boolean add(T e) { return false; }
+
+    public boolean remove(Object o) { return false; }
+
+    public boolean containsAll(Collection<?> c) { return false; }
+
+    public boolean addAll(Collection < ? extends T > c) { return false; }
+
+    public boolean retainAll(Collection<?> c) { return false; }
+
+    public boolean removeAll(Collection<?> c) { return false; }
+
+    public void clear() {}
+}
+
+// FILE: box.kt
+
+open class KotlinSet : JavaSet<String>()
+
+interface SizeInterface {
+    fun size() = 42
+}
+
+class Diamond : KotlinSet(), SizeInterface
+
+fun box(): String {
+    Diamond()
+    return "OK"
+}
\ No newline at end of file
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 3a44331..5d55976 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
@@ -33392,6 +33392,12 @@
     }
 
     @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
+    @Test
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java
index c217dfb..e4bcab6 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
@@ -31514,6 +31514,12 @@
     }
 
     @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
+    @Test
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
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 c6adbc93..e1f13ec 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
@@ -33392,6 +33392,12 @@
     }
 
     @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
+    @Test
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
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 e6055da..517adda 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
@@ -33392,6 +33392,12 @@
     }
 
     @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
+    @Test
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java
index cfff479..0ecb1ee 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java
@@ -33392,6 +33392,12 @@
     }
 
     @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
+    @Test
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java
index 40c5322..775ea4a 100644
--- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java
+++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java
@@ -28299,6 +28299,11 @@
       runTest("compiler/testData/codegen/box/javaInterop/kt48590.kt");
     }
 
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
     @TestMetadata("kt65482.kt")
     public void testKt65482() {
       runTest("compiler/testData/codegen/box/javaInterop/kt65482.kt");
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 ec36659..64aff91 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
@@ -25285,6 +25285,12 @@
       KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
     }
 
+    @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
     @Nested
     @TestMetadata("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests")
     @TestDataPath("$PROJECT_ROOT")
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 3f06b91..ff30a7b 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
@@ -25285,6 +25285,12 @@
       KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
     }
 
+    @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
     @Nested
     @TestMetadata("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests")
     @TestDataPath("$PROJECT_ROOT")
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 b366210..5784260 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
@@ -25285,6 +25285,12 @@
       KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
     }
 
+    @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
     @Nested
     @TestMetadata("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests")
     @TestDataPath("$PROJECT_ROOT")
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 42e2e9e..c7248bb 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
@@ -25285,6 +25285,12 @@
       KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
     }
 
+    @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
     @Nested
     @TestMetadata("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests")
     @TestDataPath("$PROJECT_ROOT")
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 e7e9173..a32f5b4 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
@@ -28170,6 +28170,12 @@
         KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
       }
 
+      @Test
+      @TestMetadata("kt62570.kt")
+      public void testKt62570() {
+        runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+      }
+
       @Nested
       @TestMetadata("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests")
       @TestDataPath("$PROJECT_ROOT")
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 057a000..8518a95 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
@@ -28714,6 +28714,12 @@
         KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
       }
 
+      @Test
+      @TestMetadata("kt62570.kt")
+      public void testKt62570() {
+        runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+      }
+
       @Nested
       @TestMetadata("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests")
       @TestDataPath("$PROJECT_ROOT")
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 c501bbc..1a3e908 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
@@ -27626,6 +27626,12 @@
         KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
       }
 
+      @Test
+      @TestMetadata("kt62570.kt")
+      public void testKt62570() {
+        runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+      }
+
       @Nested
       @TestMetadata("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests")
       @TestDataPath("$PROJECT_ROOT")
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 a58d8f7..59cee8a 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
@@ -28171,6 +28171,12 @@
         KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
       }
 
+      @Test
+      @TestMetadata("kt62570.kt")
+      public void testKt62570() {
+        runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+      }
+
       @Nested
       @TestMetadata("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests")
       @TestDataPath("$PROJECT_ROOT")
diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java
index 2faa4ed..c857049 100644
--- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java
+++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java
@@ -25273,6 +25273,12 @@
       KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
     }
 
+    @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
     @Nested
     @TestMetadata("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests")
     @TestDataPath("$PROJECT_ROOT")
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 ab26fe5..05039dd 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
@@ -25273,6 +25273,12 @@
       KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
     }
 
+    @Test
+    @TestMetadata("kt62570.kt")
+    public void testKt62570() {
+      runTest("compiler/testData/codegen/box/javaInterop/kt62570.kt");
+    }
+
     @Nested
     @TestMetadata("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests")
     @TestDataPath("$PROJECT_ROOT")