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 08211f5b03d..c5d9ad33332 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 @@ -31825,6 +31825,28 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("inheritTwoStaticMethods.kt") + public void testInheritTwoStaticMethods() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt"); + } + + @Test + @TestMetadata("overrideInstanceMethodWithIrrelevantStatic.kt") + public void testOverrideInstanceMethodWithIrrelevantStatic() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.kt"); + } + } } @Nested diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java index 138d7da3247..73d3bd387eb 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 @@ -31825,6 +31825,28 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("inheritTwoStaticMethods.kt") + public void testInheritTwoStaticMethods() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt"); + } + + @Test + @TestMetadata("overrideInstanceMethodWithIrrelevantStatic.kt") + public void testOverrideInstanceMethodWithIrrelevantStatic() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.kt"); + } + } } @Nested 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 38c4daed612..2185378715b 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 @@ -31494,6 +31494,28 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("inheritTwoStaticMethods.kt") + public void testInheritTwoStaticMethods() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt"); + } + + @Test + @TestMetadata("overrideInstanceMethodWithIrrelevantStatic.kt") + public void testOverrideInstanceMethodWithIrrelevantStatic() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.kt"); + } + } } @Nested diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java index 1490a3a2372..d447359f533 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java @@ -31494,6 +31494,28 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("inheritTwoStaticMethods.kt") + public void testInheritTwoStaticMethods() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt"); + } + + @Test + @TestMetadata("overrideInstanceMethodWithIrrelevantStatic.kt") + public void testOverrideInstanceMethodWithIrrelevantStatic() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.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 01a3ae4e821..397523885d9 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 @@ -31494,6 +31494,28 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("inheritTwoStaticMethods.kt") + public void testInheritTwoStaticMethods() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt"); + } + + @Test + @TestMetadata("overrideInstanceMethodWithIrrelevantStatic.kt") + public void testOverrideInstanceMethodWithIrrelevantStatic() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.kt"); + } + } } @Nested diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrFakeOverrideBuilder.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrFakeOverrideBuilder.kt index 74f8ff0cfde..9a8d386a225 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrFakeOverrideBuilder.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrFakeOverrideBuilder.kt @@ -13,10 +13,7 @@ import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.types.* -import org.jetbrains.kotlin.ir.util.collectAndFilterRealOverrides -import org.jetbrains.kotlin.ir.util.fileOrNull -import org.jetbrains.kotlin.ir.util.isFromJava -import org.jetbrains.kotlin.ir.util.render +import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.resolve.OverridingUtil.OverrideCompatibilityInfo import org.jetbrains.kotlin.types.AbstractTypeChecker import org.jetbrains.kotlin.types.TypeCheckerState @@ -65,30 +62,56 @@ class IrFakeOverrideBuilder( */ fun buildFakeOverridesForClass(clazz: IrClass, oldSignatures: Boolean) { strategy.inFile(clazz.fileOrNull) { - val allFromSuper = clazz.superTypes.flatMap { superType -> - val superClass = superType.getClass() ?: error("Unexpected super type: $superType") - superClass.declarations - .filterIsInstance() - .mapNotNull { - val fakeOverride = strategy.fakeOverrideMember(superType, it, clazz) ?: return@mapNotNull null - FakeOverride(fakeOverride, it) - } - } + val (staticMembers, instanceMembers) = + clazz.declarations.filterIsInstance().partition { it.isStaticMember } - val allFromSuperByName = allFromSuper.groupBy { it.override.name } - val allFromCurrentByName = clazz.declarations.filterIsInstance().groupBy { it.name } + buildFakeOverridesForClassImpl(clazz, instanceMembers, oldSignatures, clazz.superTypes) { !it.isStaticMember } - allFromSuperByName.forEach { (name, superMembers) -> - generateOverridesInFunctionGroup( - superMembers, - allFromCurrentByName[name] ?: emptyList(), - clazz, - oldSignatures - ) - } + // Static Java members from the superclass need fake overrides in the subclass, to support the case when the static member is + // declared in an inaccessible grandparent class but is exposed as public in the parent. For example: + // + // class A { public static void f() {} } + // public class B extends A {} + // + // `A.f` is inaccessible from another package, but `B.f` is accessible from everywhere because Java doesn't have the + // "exposed visibility" error. Accessing the method via the class A would result in an IllegalAccessError at runtime, thus + // we need to generate a fake override in class B. This is only possible in case of superclasses, as static _interface_ members + // are not inherited (see JLS 8.4.8 and 9.4.1). + val superClass = clazz.superTypes.filter { it.classOrFail.owner.isClass } + buildFakeOverridesForClassImpl(clazz, staticMembers, oldSignatures, superClass) { it.isStaticMember } } } + private fun buildFakeOverridesForClassImpl( + clazz: IrClass, + allFromCurrent: List, + oldSignatures: Boolean, + supertypes: List, + declarationFilter: (IrOverridableMember) -> Boolean, + ) { + val allFromSuper = supertypes.flatMap { superType -> + superType.classOrFail.owner.declarations + .filterIsInstanceAnd(declarationFilter) + .mapNotNull { + val fakeOverride = strategy.fakeOverrideMember(superType, it, clazz) ?: return@mapNotNull null + FakeOverride(fakeOverride, it) + } + } + + val allFromSuperByName = allFromSuper.groupBy { it.override.name } + val allFromCurrentByName = allFromCurrent.groupBy { it.name } + + allFromSuperByName.forEach { (name, superMembers) -> + generateOverridesInFunctionGroup( + superMembers, + allFromCurrentByName[name] ?: emptyList(), + clazz, + oldSignatures + ) + } + + } + /** * This function builds all missing fake overrides, assuming that already existing members have correct overriden symbols. * diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrOverrideChecker.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrOverrideChecker.kt index c9bc0ac9d08..78bcce8dbd2 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrOverrideChecker.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrOverrideChecker.kt @@ -69,7 +69,6 @@ class IrOverrideChecker( is IrSimpleFunction -> when { subMember !is IrSimpleFunction -> return incompatible("Member kind mismatch") superMember.hasExtensionReceiver != subMember.hasExtensionReceiver -> return incompatible("Receiver presence mismatch") - superMember.hasDispatchReceiver != subMember.hasDispatchReceiver -> return incompatible("Incompatible staticness") superMember.isSuspend != subMember.isSuspend -> return incompatible("Incompatible suspendability") checkIsInlineFlag && superMember.isInline -> return incompatible("Inline function can't be overridden") @@ -83,7 +82,6 @@ class IrOverrideChecker( is IrProperty -> when { subMember !is IrProperty -> return incompatible("Member kind mismatch") superMember.getter.hasExtensionReceiver != subMember.getter.hasExtensionReceiver -> return incompatible("Receiver presence mismatch") - superMember.getter.hasDispatchReceiver != subMember.getter.hasDispatchReceiver -> return incompatible("Incompatible staticness") checkIsInlineFlag && superMember.isInline -> return incompatible("Inline property can't be overridden") else -> { diff --git a/compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt b/compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt new file mode 100644 index 00000000000..28a95068c8b --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt @@ -0,0 +1,18 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// FILE: A.java +public interface A { + static String foo() { return "OK"; } +} + +// FILE: B.java +public interface B { + static String foo() { return "Fail"; } +} + +// FILE: box.kt +class C : A, B { + fun test(): String = A.foo() +} + +fun box(): String = C().test() diff --git a/compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.kt b/compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.kt new file mode 100644 index 00000000000..9445926e845 --- /dev/null +++ b/compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.kt @@ -0,0 +1,20 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// FILE: A.java +public class A { + protected String foo() { return "OK"; } +} + +// FILE: B.java +public interface B { + static String foo() { return "Fail"; } +} + +// FILE: box.kt +class C : A(), B { + override fun foo(): String = super.foo() + + fun test(): String = foo() +} + +fun box(): String = C().test() 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 58ecc202b8f..9fb5c93d2f6 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 @@ -31494,6 +31494,28 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("inheritTwoStaticMethods.kt") + public void testInheritTwoStaticMethods() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt"); + } + + @Test + @TestMetadata("overrideInstanceMethodWithIrrelevantStatic.kt") + public void testOverrideInstanceMethodWithIrrelevantStatic() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.kt"); + } + } } @Nested diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index bada07a0d51..3c397875f93 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 @@ -29700,6 +29700,28 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("inheritTwoStaticMethods.kt") + public void testInheritTwoStaticMethods() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt"); + } + + @Test + @TestMetadata("overrideInstanceMethodWithIrrelevantStatic.kt") + public void testOverrideInstanceMethodWithIrrelevantStatic() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.kt"); + } + } } @Nested diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 5564f52308d..5255c3b22c1 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 @@ -31494,6 +31494,28 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("inheritTwoStaticMethods.kt") + public void testInheritTwoStaticMethods() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt"); + } + + @Test + @TestMetadata("overrideInstanceMethodWithIrrelevantStatic.kt") + public void testOverrideInstanceMethodWithIrrelevantStatic() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.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 c20099f402c..9f9297e16e5 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 @@ -31494,6 +31494,28 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("inheritTwoStaticMethods.kt") + public void testInheritTwoStaticMethods() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt"); + } + + @Test + @TestMetadata("overrideInstanceMethodWithIrrelevantStatic.kt") + public void testOverrideInstanceMethodWithIrrelevantStatic() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.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 025c12da052..8af2c2c730c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -26718,6 +26718,29 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance/nullableInt.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Statics extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("inheritTwoStaticMethods.kt") + public void testInheritTwoStaticMethods() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods.kt"); + } + + @TestMetadata("overrideInstanceMethodWithIrrelevantStatic.kt") + public void testOverrideInstanceMethodWithIrrelevantStatic() throws Exception { + runTest("compiler/testData/codegen/box/javaInterop/statics/overrideInstanceMethodWithIrrelevantStatic.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/javaVisibility") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 0115a363f99..f747ee79218 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 @@ -22992,6 +22992,16 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } } @Nested diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java index 2e0f93ed045..f31d6dce062 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 @@ -22992,6 +22992,16 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } } @Nested diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 18fef4fca23..696228532e2 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 @@ -22992,6 +22992,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), 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 6c3376b4891..d4dcaf273fd 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 @@ -22992,6 +22992,16 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java index 0fbfc660ec0..bb2d078861c 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 @@ -26579,6 +26579,19 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java index 88157c38f27..6447bab5bb3 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 @@ -27123,6 +27123,21 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java index e40f25f630c..0de55996da8 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 @@ -26035,6 +26035,17 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java index 9903d07e5cb..e0c7e8cd586 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 @@ -26580,6 +26580,19 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } } @Nested 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 d4677540769..e21cbdb4b01 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 @@ -22980,6 +22980,16 @@ public class FirWasmJsCodegenBoxTestGenerated extends AbstractFirWasmJsCodegenBo KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } } @Nested diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java index 9bb3493a7d8..e9f7c1c685d 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 @@ -22980,6 +22980,16 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/primitiveVsWrapperTypeInInheritance"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } } + + @Nested + @TestMetadata("compiler/testData/codegen/box/javaInterop/statics") + @TestDataPath("$PROJECT_ROOT") + public class Statics { + @Test + public void testAllFilesPresentInStatics() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/statics"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } } @Nested