From bdaacb9427bfdbc9b6a2fbef19f972b7e11a8361 Mon Sep 17 00:00:00 2001 From: Brian Norman Date: Wed, 6 Mar 2024 10:50:13 -0600 Subject: [PATCH] [AllOpen] Test case to recreate open annotation member warning The AllOpen compiler plugin opens all declarations of the annotated class, regardless of class type. However, it only opens classes (not interfaces, objects, enums, etc). This leads to a warning where members of an annotation are open when annotated. Spring has many such annotations, as it is common to create meta-annotations from the core set of AllOpen supported annotations. ^KT-63507 --- .../testData/diagnostics/allOpenOnAnnotation.fir.kt | 9 +++++++++ .../allopen/testData/diagnostics/allOpenOnAnnotation.kt | 9 +++++++++ .../allopen/DiagnosticTestForAllOpenBaseGenerated.java | 6 ++++++ .../FirLightTreeDiagnosticTestForAllOpenGenerated.java | 6 ++++++ .../allopen/FirPsiDiagnosticTestForAllOpenGenerated.java | 6 ++++++ 5 files changed, 36 insertions(+) create mode 100644 plugins/allopen/testData/diagnostics/allOpenOnAnnotation.fir.kt create mode 100644 plugins/allopen/testData/diagnostics/allOpenOnAnnotation.kt diff --git a/plugins/allopen/testData/diagnostics/allOpenOnAnnotation.fir.kt b/plugins/allopen/testData/diagnostics/allOpenOnAnnotation.fir.kt new file mode 100644 index 00000000000..863810dfd08 --- /dev/null +++ b/plugins/allopen/testData/diagnostics/allOpenOnAnnotation.fir.kt @@ -0,0 +1,9 @@ +// WITH_STDLIB +// ISSUE: KT-63507 + +annotation class AllOpen + +@AllOpen +annotation class SubComponent( + val scope: String +) diff --git a/plugins/allopen/testData/diagnostics/allOpenOnAnnotation.kt b/plugins/allopen/testData/diagnostics/allOpenOnAnnotation.kt new file mode 100644 index 00000000000..3e48ce69633 --- /dev/null +++ b/plugins/allopen/testData/diagnostics/allOpenOnAnnotation.kt @@ -0,0 +1,9 @@ +// WITH_STDLIB +// ISSUE: KT-63507 + +annotation class AllOpen + +@AllOpen +annotation class SubComponent( + val scope: String +) diff --git a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/DiagnosticTestForAllOpenBaseGenerated.java b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/DiagnosticTestForAllOpenBaseGenerated.java index 2c42991a79b..03325481172 100644 --- a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/DiagnosticTestForAllOpenBaseGenerated.java +++ b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/DiagnosticTestForAllOpenBaseGenerated.java @@ -23,6 +23,12 @@ public class DiagnosticTestForAllOpenBaseGenerated extends AbstractDiagnosticTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/allopen/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("allOpenOnAnnotation.kt") + public void testAllOpenOnAnnotation() { + runTest("plugins/allopen/testData/diagnostics/allOpenOnAnnotation.kt"); + } + @Test @TestMetadata("kt54260.kt") public void testKt54260() { diff --git a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirLightTreeDiagnosticTestForAllOpenGenerated.java b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirLightTreeDiagnosticTestForAllOpenGenerated.java index eb0ea505be6..be11584e0d0 100644 --- a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirLightTreeDiagnosticTestForAllOpenGenerated.java +++ b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirLightTreeDiagnosticTestForAllOpenGenerated.java @@ -23,6 +23,12 @@ public class FirLightTreeDiagnosticTestForAllOpenGenerated extends AbstractFirLi KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/allopen/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("allOpenOnAnnotation.kt") + public void testAllOpenOnAnnotation() { + runTest("plugins/allopen/testData/diagnostics/allOpenOnAnnotation.kt"); + } + @Test @TestMetadata("kt54260.kt") public void testKt54260() { diff --git a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirPsiDiagnosticTestForAllOpenGenerated.java b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirPsiDiagnosticTestForAllOpenGenerated.java index 7dfaa20fb32..3bcac93a999 100644 --- a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirPsiDiagnosticTestForAllOpenGenerated.java +++ b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirPsiDiagnosticTestForAllOpenGenerated.java @@ -23,6 +23,12 @@ public class FirPsiDiagnosticTestForAllOpenGenerated extends AbstractFirPsiDiagn KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/allopen/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("allOpenOnAnnotation.kt") + public void testAllOpenOnAnnotation() { + runTest("plugins/allopen/testData/diagnostics/allOpenOnAnnotation.kt"); + } + @Test @TestMetadata("kt54260.kt") public void testKt54260() {