diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index e2ffedd375f..f6964040350 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -23490,12 +23490,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/jvmStatic/companionObject.kt"); } - @Test - @TestMetadata("companionObjectProtected.kt") - public void testCompanionObjectProtected() throws Exception { - runTest("compiler/testData/codegen/box/jvmStatic/companionObjectProtected.kt"); - } - @Test @TestMetadata("convention.kt") public void testConvention() throws Exception { @@ -23687,6 +23681,34 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT public void testSyntheticAccessor() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/syntheticAccessor.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass") + @TestDataPath("$PROJECT_ROOT") + public class ProtectedInSuperClass { + @Test + public void testAllFilesPresentInProtectedInSuperClass() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("defaultArguments.kt") + public void testDefaultArguments() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/defaultArguments.kt"); + } + + @Test + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleFunction.kt"); + } + + @Test + @TestMetadata("simpleProperty.kt") + public void testSimpleProperty() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleProperty.kt"); + } + } } @Nested diff --git a/compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/defaultArguments.kt b/compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/defaultArguments.kt new file mode 100644 index 00000000000..7e1ae24ac90 --- /dev/null +++ b/compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/defaultArguments.kt @@ -0,0 +1,20 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// FILE: 1.kt +package a + +open class A { + companion object { + @JvmStatic + protected fun foo(result: String = "OK"): String = result + } +} + +// FILE: 2.kt +import a.* + +class B : A() { + fun bar(): String = foo() +} + +fun box() = B().bar() diff --git a/compiler/testData/codegen/box/jvmStatic/companionObjectProtected.kt b/compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleFunction.kt similarity index 100% rename from compiler/testData/codegen/box/jvmStatic/companionObjectProtected.kt rename to compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleFunction.kt diff --git a/compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleProperty.kt b/compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleProperty.kt new file mode 100644 index 00000000000..b01f953dd48 --- /dev/null +++ b/compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleProperty.kt @@ -0,0 +1,26 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND: JVM +// WITH_RUNTIME +// FILE: 1.kt +package a + +open class A { + companion object { + @JvmStatic + @get:JvmStatic + @set:JvmStatic + protected var foo = "Fail" + } +} + +// FILE: 2.kt +import a.* + +class B : A() { + fun bar(): String { + foo = "OK" + return foo + } +} + +fun box() = B().bar() 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 296a822131e..e321fec6027 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 @@ -23472,12 +23472,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/jvmStatic/companionObject.kt"); } - @Test - @TestMetadata("companionObjectProtected.kt") - public void testCompanionObjectProtected() throws Exception { - runTest("compiler/testData/codegen/box/jvmStatic/companionObjectProtected.kt"); - } - @Test @TestMetadata("convention.kt") public void testConvention() throws Exception { @@ -23669,6 +23663,34 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testSyntheticAccessor() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/syntheticAccessor.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass") + @TestDataPath("$PROJECT_ROOT") + public class ProtectedInSuperClass { + @Test + public void testAllFilesPresentInProtectedInSuperClass() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("defaultArguments.kt") + public void testDefaultArguments() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/defaultArguments.kt"); + } + + @Test + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleFunction.kt"); + } + + @Test + @TestMetadata("simpleProperty.kt") + public void testSimpleProperty() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleProperty.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 358e4de8f76..f80838c73ef 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 @@ -23490,12 +23490,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/jvmStatic/companionObject.kt"); } - @Test - @TestMetadata("companionObjectProtected.kt") - public void testCompanionObjectProtected() throws Exception { - runTest("compiler/testData/codegen/box/jvmStatic/companionObjectProtected.kt"); - } - @Test @TestMetadata("convention.kt") public void testConvention() throws Exception { @@ -23687,6 +23681,34 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testSyntheticAccessor() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/syntheticAccessor.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass") + @TestDataPath("$PROJECT_ROOT") + public class ProtectedInSuperClass { + @Test + public void testAllFilesPresentInProtectedInSuperClass() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("defaultArguments.kt") + public void testDefaultArguments() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/defaultArguments.kt"); + } + + @Test + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleFunction.kt"); + } + + @Test + @TestMetadata("simpleProperty.kt") + public void testSimpleProperty() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleProperty.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 d0cae79930b..532a5bf2754 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -19761,11 +19761,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class JvmStatic extends AbstractLightAnalysisModeTest { - @TestMetadata("companionObjectProtected.kt") - public void ignoreCompanionObjectProtected() throws Exception { - runTest("compiler/testData/codegen/box/jvmStatic/companionObjectProtected.kt"); - } - @TestMetadata("extensionPropertyGetter.kt") public void ignoreExtensionPropertyGetter() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/extensionPropertyGetter.kt"); @@ -19948,6 +19943,34 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testSyntheticAccessor() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/syntheticAccessor.kt"); } + + @TestMetadata("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ProtectedInSuperClass extends AbstractLightAnalysisModeTest { + @TestMetadata("defaultArguments.kt") + public void ignoreDefaultArguments() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/defaultArguments.kt"); + } + + @TestMetadata("simpleFunction.kt") + public void ignoreSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleFunction.kt"); + } + + @TestMetadata("simpleProperty.kt") + public void ignoreSimpleProperty() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleProperty.kt"); + } + + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInProtectedInSuperClass() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + } } @TestMetadata("compiler/testData/codegen/box/labels") diff --git a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/VisualizerBlackBoxTestGenerated.java b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/VisualizerBlackBoxTestGenerated.java index bc09a31150c..d51860a714b 100644 --- a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/VisualizerBlackBoxTestGenerated.java +++ b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/VisualizerBlackBoxTestGenerated.java @@ -23698,6 +23698,34 @@ public class VisualizerBlackBoxTestGenerated extends AbstractVisualizerBlackBoxT public void testSyntheticAccessor() throws Exception { runTest("compiler/testData/codegen/box/jvmStatic/syntheticAccessor.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass") + @TestDataPath("$PROJECT_ROOT") + public class ProtectedInSuperClass { + @Test + public void testAllFilesPresentInProtectedInSuperClass() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("defaultArguments.kt") + public void testDefaultArguments() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/defaultArguments.kt"); + } + + @Test + @TestMetadata("simpleFunction.kt") + public void testSimpleFunction() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleFunction.kt"); + } + + @Test + @TestMetadata("simpleProperty.kt") + public void testSimpleProperty() throws Exception { + runTest("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass/simpleProperty.kt"); + } + } } @Nested diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 1ef87feae8d..d77cd3ab7b1 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -15612,6 +15612,19 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testAllFilesPresentInJvmStatic() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + + @TestMetadata("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ProtectedInSuperClass extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInProtectedInSuperClass() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } } @TestMetadata("compiler/testData/codegen/box/labels") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 62cc9d57f5d..b9c9f7f370e 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -15033,6 +15033,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testAllFilesPresentInJvmStatic() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + + @TestMetadata("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ProtectedInSuperClass extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInProtectedInSuperClass() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } } @TestMetadata("compiler/testData/codegen/box/labels") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 1eca5a46681..f2059f625a6 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -15098,6 +15098,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testAllFilesPresentInJvmStatic() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } + + @TestMetadata("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ProtectedInSuperClass extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInProtectedInSuperClass() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + } } @TestMetadata("compiler/testData/codegen/box/labels") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index ab95f6273a6..8ec88e53801 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -8979,6 +8979,19 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest public void testAllFilesPresentInJvmStatic() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + + @TestMetadata("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ProtectedInSuperClass extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInProtectedInSuperClass() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvmStatic/protectedInSuperClass"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } } @TestMetadata("compiler/testData/codegen/box/labels")