From 1e031d9fb8268a1c6c55359bda79b1e9d0fe72d7 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 28 Mar 2023 23:44:42 +0200 Subject: [PATCH] Reflection: add test on introspection of local classes kotlin-reflect works correctly already for Kotlin-generated local classes and anonymous objects, but not for Java ones. This is fixed in a subsequent commit. #KT-41373 In Progress --- ...LightTreeBlackBoxCodegenTestGenerated.java | 16 ++ .../FirPsiBlackBoxCodegenTestGenerated.java | 16 ++ .../localClassesAndAnonymousObjects.kt | 144 ++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 16 ++ .../IrBlackBoxCodegenTestGenerated.java | 16 ++ ...kBoxCodegenWithIrInlinerTestGenerated.java | 16 ++ .../LightAnalysisModeTestGenerated.java | 18 +++ .../fir/FirJsCodegenBoxTestGenerated.java | 10 ++ .../test/ir/IrJsCodegenBoxTestGenerated.java | 10 ++ .../ir/IrJsES6CodegenBoxTestGenerated.java | 10 ++ .../FirNativeCodegenBoxTestGenerated.java | 13 ++ .../FirNativeCodegenBoxTestNoPLGenerated.java | 15 ++ .../NativeCodegenBoxTestGenerated.java | 12 ++ .../NativeCodegenBoxTestNoPLGenerated.java | 13 ++ .../test/FirWasmCodegenBoxTestGenerated.java | 10 ++ .../test/K1WasmCodegenBoxTestGenerated.java | 10 ++ 16 files changed, 345 insertions(+) create mode 100644 compiler/testData/codegen/box/reflection/localClasses/localClassesAndAnonymousObjects.kt 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 69330b2221f..afd440468bc 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 @@ -45305,6 +45305,22 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("localClassesAndAnonymousObjects.kt") + public void testLocalClassesAndAnonymousObjects() throws Exception { + runTest("compiler/testData/codegen/box/reflection/localClasses/localClassesAndAnonymousObjects.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") 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 2f0700752a4..96a492a5baf 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 @@ -45305,6 +45305,22 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("localClassesAndAnonymousObjects.kt") + public void testLocalClassesAndAnonymousObjects() throws Exception { + runTest("compiler/testData/codegen/box/reflection/localClasses/localClassesAndAnonymousObjects.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/testData/codegen/box/reflection/localClasses/localClassesAndAnonymousObjects.kt b/compiler/testData/codegen/box/reflection/localClasses/localClassesAndAnonymousObjects.kt new file mode 100644 index 00000000000..ecd38907402 --- /dev/null +++ b/compiler/testData/codegen/box/reflection/localClasses/localClassesAndAnonymousObjects.kt @@ -0,0 +1,144 @@ +// TARGET_BACKEND: JVM +// WITH_REFLECT +// FILE: anonymousObjects.kt + +package test + +import kotlin.reflect.* +import kotlin.reflect.jvm.isAccessible +import kotlin.test.* + +interface I + +fun check(x: KClass<*>, value: Any) { + assertEquals(null, x.qualifiedName) + + assertEquals( + setOf( + "foo", "bar", + "equals", "hashCode", "toString" + ), + x.members.mapTo(hashSetOf()) { it.name } + ) + + assertEquals(emptyList(), x.annotations) + assertEquals(emptyList(), x.nestedClasses) + assertEquals(null, x.objectInstance) + assertEquals(emptyList(), x.sealedSubclasses) + + assertEquals(listOf(typeOf(), typeOf()), x.supertypes) + + // Local class visibility cannot be represented in Kotlin, so `KClass.visibility` is null. + assertEquals(null, x.visibility) + + // It's not really important whether the class is considered final or open, but it shouldn't be both (or neither). + assertTrue(x.isFinal xor x.isOpen) + + assertFalse(x.isAbstract) + assertFalse(x.isSealed) + assertFalse(x.isData) + assertFalse(x.isInner) + assertFalse(x.isCompanion) + assertFalse(x.isFun) + assertFalse(x.isValue) + + assertFalse(x.isInstance(42)) + assertTrue(x.isInstance(value)) + + val equals = x.members.single { it.name == "equals" } as KFunction + assertTrue(equals.call(value, value)) + + val foo = x.members.single { it.name == "foo" }.apply { isAccessible = true } as KFunction + assertEquals("OK", foo.call(value)) + + val bar = x.members.single { it.name == "bar" }.apply { isAccessible = true } as KProperty1 + assertEquals(42, bar.get(value)) +} + +fun checkKotlinAnonymousObject() { + val anonymousObject = object : I { + val bar: Int = 42 + fun foo(): String = "OK" + } + val klass = anonymousObject::class + + // isAnonymousClass/simpleName behavior is different for Kotlin anonymous classes in JDK 1.8 and 9+, see KT-23072. + if (klass.java.isAnonymousClass) { + assertEquals(null, klass.simpleName) + } else { + assertEquals("anonymousObject\$1", klass.simpleName) + } + + assertEquals(emptyList(), klass.constructors) + + check(klass, anonymousObject) +} + +fun checkKotlinLocalClass() { + class Local : I { + val bar: Int = 42 + fun foo(): String = "OK" + } + val instance = Local() + val klass = instance::class + + // simpleName behavior is different for Kotlin anonymous classes in JDK 1.8 and 9+, see KT-23072. + assertTrue(klass.simpleName!!.endsWith("Local")) + + assertEquals(listOf("fun ``(): test.`AnonymousObjectsKt\$checkKotlinLocalClass\$Local`"), klass.constructors.map { it.toString() }) + + check(klass, instance) +} + +fun checkJavaAnonymousObject() { + val anonymousObject = JavaClass.anonymousObject() + val klass = anonymousObject::class + + assertEquals(null, klass.simpleName) + + assertEquals(listOf("fun ``(): `JavaClass$1`"), klass.constructors.map { it.toString() }) + + check(klass, anonymousObject) +} + +fun checkJavaLocalClass() { + val instance = JavaClass.localClassInstance() + val klass = instance::class + + assertEquals("Local", klass.simpleName) + + assertEquals(listOf("fun ``(): Local"), klass.constructors.map { it.toString() }) + + check(klass, instance) +} + +fun box(): String { + checkKotlinAnonymousObject() + checkKotlinLocalClass() + + // TODO: fails with KotlinReflectionInternalError: Unresolved class: class JavaClass$1 (kind = null) + // checkJavaAnonymousObject() + // checkJavaLocalClass() + + return "OK" +} + +// FILE: JavaClass.java + +public class JavaClass { + public static Object anonymousObject() { + return new test.I() { + int bar = 42; + String foo() { return "OK"; } + }; + } + + public static Object localClassInstance() { + class Local implements test.I { + int bar = 42; + String foo() { return "OK"; } + } + + return new Local(); + } +} 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 06e9d602e4c..c750a7c1d7b 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 @@ -42647,6 +42647,22 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("localClassesAndAnonymousObjects.kt") + public void testLocalClassesAndAnonymousObjects() throws Exception { + runTest("compiler/testData/codegen/box/reflection/localClasses/localClassesAndAnonymousObjects.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") 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 f8a1d95f0c3..8bae8ffd1f6 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 @@ -45305,6 +45305,22 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("localClassesAndAnonymousObjects.kt") + public void testLocalClassesAndAnonymousObjects() throws Exception { + runTest("compiler/testData/codegen/box/reflection/localClasses/localClassesAndAnonymousObjects.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") 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 b4656320aef..96931e37252 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 @@ -45305,6 +45305,22 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("localClassesAndAnonymousObjects.kt") + public void testLocalClassesAndAnonymousObjects() throws Exception { + runTest("compiler/testData/codegen/box/reflection/localClasses/localClassesAndAnonymousObjects.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index e3da85e7454..9756c62bf02 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -36008,6 +36008,24 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class LocalClasses extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("localClassesAndAnonymousObjects.kt") + public void testLocalClassesAndAnonymousObjects() throws Exception { + runTest("compiler/testData/codegen/box/reflection/localClasses/localClassesAndAnonymousObjects.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) 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 8c902dfdf9d..00a7f931ebb 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 @@ -32537,6 +32537,16 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @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 cd341ab4386..081a87d3fdd 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 @@ -32537,6 +32537,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @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 902a2e25678..e29804c9b49 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 @@ -32537,6 +32537,16 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java index 921e5894a32..8e5ee65134c 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java @@ -35884,6 +35884,19 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java index 3f19e089ddf..c4d2a92afcc 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java @@ -36760,6 +36760,21 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index 6346968f4a5..88ddbf30679 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -35447,6 +35447,18 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @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 LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java index 151391e0f70..71378a17ae2 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java @@ -35885,6 +35885,19 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT") diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java index 3826e2f836c..96793456cc6 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java @@ -32345,6 +32345,16 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @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 cf65d1fdc34..99ca0a53e0d 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 @@ -32345,6 +32345,16 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest } } + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/localClasses") + @TestDataPath("$PROJECT_ROOT") + public class LocalClasses { + @Test + public void testAllFilesPresentInLocalClasses() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/localClasses"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/reflection/mapping") @TestDataPath("$PROJECT_ROOT")