From 24a31725d9c188f2dab5eef2481230cffefaa7bf Mon Sep 17 00:00:00 2001 From: "Alexander.Danilov" Date: Fri, 1 Dec 2023 09:55:18 +0100 Subject: [PATCH] add some more test data with Java interop for UnusedSymbolInspection GitOrigin-RevId: 66b71ce5d53c7224867a6892f27e76fa5bb5452d --- ...MultiFileLocalInspectionTestGenerated.java | 26 +++++++++++++++++++ ...MultiFileLocalInspectionTestGenerated.java | 10 +++++++ .../unusedSymbol/jvmField/after/User.java | 4 +++ .../unusedSymbol/jvmField/after/test.kt | 3 +++ .../unusedSymbol/jvmField/before/User.java | 4 +++ .../unusedSymbol/jvmField/before/test.kt | 3 +++ .../unusedSymbol/jvmField/jvmFieldTest.test | 6 +++++ .../after/User.java | 5 ++++ .../topLevelFunctionWithJvmName/after/test.kt | 5 ++++ .../before/User.java | 5 ++++ .../before/test.kt | 5 ++++ .../topLevelFunctionWithJvmName.test | 6 +++++ 12 files changed, 82 insertions(+) create mode 100644 plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/after/User.java create mode 100644 plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/after/test.kt create mode 100644 plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/before/User.java create mode 100644 plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/before/test.kt create mode 100644 plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/jvmFieldTest.test create mode 100644 plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/after/User.java create mode 100644 plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/after/test.kt create mode 100644 plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/before/User.java create mode 100644 plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/before/test.kt create mode 100644 plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/topLevelFunctionWithJvmName.test diff --git a/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2MultiFileLocalInspectionTestGenerated.java b/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2MultiFileLocalInspectionTestGenerated.java index 42ddcaca03ee..8a9d407cd4c1 100644 --- a/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2MultiFileLocalInspectionTestGenerated.java +++ b/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2MultiFileLocalInspectionTestGenerated.java @@ -73,6 +73,19 @@ public abstract class K2MultiFileLocalInspectionTestGenerated extends AbstractK2 } } + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../../../idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField") + public static class JvmField extends AbstractK2MultiFileLocalInspectionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("jvmFieldTest.test") + public void testJvmFieldTest() throws Exception { + runTest("../../../idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/jvmFieldTest.test"); + } + } + @RunWith(JUnit3RunnerWithInners.class) @TestMetadata("../../../idea/tests/testData/multiFileLocalInspections/unusedSymbol/propertyWithJvmNameAnnotation") public static class PropertyWithJvmNameAnnotation extends AbstractK2MultiFileLocalInspectionTest { @@ -85,6 +98,19 @@ public abstract class K2MultiFileLocalInspectionTestGenerated extends AbstractK2 runTest("../../../idea/tests/testData/multiFileLocalInspections/unusedSymbol/propertyWithJvmNameAnnotation/propertyWithJvmNameAnnotation.test"); } } + + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../../../idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName") + public static class TopLevelFunctionWithJvmName extends AbstractK2MultiFileLocalInspectionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("topLevelFunctionWithJvmName.test") + public void testTopLevelFunctionWithJvmName() throws Exception { + runTest("../../../idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/topLevelFunctionWithJvmName.test"); + } + } } @RunWith(JUnit3RunnerWithInners.class) diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/MultiFileLocalInspectionTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/MultiFileLocalInspectionTestGenerated.java index 963132bf4e24..9b9aafeb91f4 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/MultiFileLocalInspectionTestGenerated.java +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/MultiFileLocalInspectionTestGenerated.java @@ -133,11 +133,21 @@ public class MultiFileLocalInspectionTestGenerated extends AbstractMultiFileLoca runTest("testData/multiFileLocalInspections/unusedSymbol/internalConstructorUsedInJava/internalConstructorUsedInJava.test"); } + @TestMetadata("unusedSymbol/jvmField/jvmFieldTest.test") + public void testUnusedSymbol_jvmField_JvmFieldTest() throws Exception { + runTest("testData/multiFileLocalInspections/unusedSymbol/jvmField/jvmFieldTest.test"); + } + @TestMetadata("unusedSymbol/propertyWithJvmNameAnnotation/propertyWithJvmNameAnnotation.test") public void testUnusedSymbol_propertyWithJvmNameAnnotation_PropertyWithJvmNameAnnotation() throws Exception { runTest("testData/multiFileLocalInspections/unusedSymbol/propertyWithJvmNameAnnotation/propertyWithJvmNameAnnotation.test"); } + @TestMetadata("unusedSymbol/topLevelFunctionWithJvmName/topLevelFunctionWithJvmName.test") + public void testUnusedSymbol_topLevelFunctionWithJvmName_TopLevelFunctionWithJvmName() throws Exception { + runTest("testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/topLevelFunctionWithJvmName.test"); + } + @TestMetadata("usePropertyAccessSyntax/excludedCustomAccessor/excludedCustomAccessor.test") public void testUsePropertyAccessSyntax_excludedCustomAccessor_ExcludedCustomAccessor() throws Exception { runTest("testData/multiFileLocalInspections/usePropertyAccessSyntax/excludedCustomAccessor/excludedCustomAccessor.test"); diff --git a/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/after/User.java b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/after/User.java new file mode 100644 index 000000000000..55da0b83031f --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/after/User.java @@ -0,0 +1,4 @@ +public class User { + public String getID(ForJavaClass user) { + return user.ID;} +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/after/test.kt b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/after/test.kt new file mode 100644 index 000000000000..67b2e859db30 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/after/test.kt @@ -0,0 +1,3 @@ +class ForJavaClass { + @JvmField val ID = "11" +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/before/User.java b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/before/User.java new file mode 100644 index 000000000000..55da0b83031f --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/before/User.java @@ -0,0 +1,4 @@ +public class User { + public String getID(ForJavaClass user) { + return user.ID;} +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/before/test.kt b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/before/test.kt new file mode 100644 index 000000000000..290f83eb7c7d --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/before/test.kt @@ -0,0 +1,3 @@ +class ForJavaClass { + @JvmField val ID = "11" +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/jvmFieldTest.test b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/jvmFieldTest.test new file mode 100644 index 000000000000..cdea3e7de67b --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/jvmField/jvmFieldTest.test @@ -0,0 +1,6 @@ +{ + "inspectionClass": "org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection", + "k2InspectionClass": "org.jetbrains.kotlin.idea.k2.codeinsight.inspections.UnusedSymbolInspection", + "problem": "none", + "mainFile": "test.kt" +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/after/User.java b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/after/User.java new file mode 100644 index 000000000000..a4b4d064ee17 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/after/User.java @@ -0,0 +1,5 @@ +public class User { + public static void getID() { + DemoUtils.topLevelFun(); + } +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/after/test.kt b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/after/test.kt new file mode 100644 index 000000000000..5361a3709a00 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/after/test.kt @@ -0,0 +1,5 @@ +@file:JvmName("DemoUtils") + +fun topLevelFun() { + +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/before/User.java b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/before/User.java new file mode 100644 index 000000000000..a4b4d064ee17 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/before/User.java @@ -0,0 +1,5 @@ +public class User { + public static void getID() { + DemoUtils.topLevelFun(); + } +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/before/test.kt b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/before/test.kt new file mode 100644 index 000000000000..9a15b6afaa23 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/before/test.kt @@ -0,0 +1,5 @@ +@file:JvmName("DemoUtils") + +fun topLevelFun() { + +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/topLevelFunctionWithJvmName.test b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/topLevelFunctionWithJvmName.test new file mode 100644 index 000000000000..cdea3e7de67b --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiFileLocalInspections/unusedSymbol/topLevelFunctionWithJvmName/topLevelFunctionWithJvmName.test @@ -0,0 +1,6 @@ +{ + "inspectionClass": "org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection", + "k2InspectionClass": "org.jetbrains.kotlin.idea.k2.codeinsight.inspections.UnusedSymbolInspection", + "problem": "none", + "mainFile": "test.kt" +} \ No newline at end of file