From 5affb9a25cd2cd645dbe09a8b16011534b4fa620 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 21 Dec 2017 14:12:54 +0300 Subject: [PATCH] Refactoring: "package matching directory" is now an inspection --- .../kotlin/generators/tests/GenerateTests.kt | 5 + .../after.kt.template | 8 -- .../before.kt.template | 10 -- .../description.html | 6 - .../after.kt.template | 10 -- .../before.kt.template | 10 -- .../description.html | 5 - idea/src/META-INF/plugin.xml | 10 -- .../ChangePackageToMatchDirectoryIntention.kt | 50 -------- ...FileToPackageMatchingDirectoryIntention.kt | 79 ------------- .../PackageDirectoryMismatchInspection.kt | 109 ++++++++++++++++-- .../moveToDefaultDirectory.test | 5 - .../moveToNonDefaultDirectory.test | 5 - .../packageMatchesDirectory.test | 5 - .../addQuotation/addQuotation.test | 5 - .../changeToDefaultPackage.test | 5 - .../changeToNonDefaultPackage.test | 5 - .../innerClass/innerClass.test | 5 - .../packageMatchesDirectory.test | 5 - .../after/source/dummy.kt | 0 .../moveToDefaultDirectory/after/test.kt | 0 .../before/source/dummy.kt | 0 .../before/source/test.kt | 0 .../moveToDefaultDirectory.test | 5 + .../after/source/dummy.kt | 0 .../after/target/test.kt | 0 .../before/source/dummy.kt | 0 .../before/source/test.kt | 0 .../moveToNonDefaultDirectory.test | 5 + .../after/foo/bar/test.kt | 0 .../before/foo/bar/test.kt | 0 .../packageMatchesDirectory.test | 5 + .../addQuotation/addQuotation.test | 5 + .../addQuotation/after/in/foo/fun/test.kt | 0 .../after/in/foo/fun/usagesWithFqNames.java | 0 .../after/in/foo/fun/usagesWithFqNames.kt | 0 .../after/in/foo/fun/usagesWithImports.java | 0 .../after/in/foo/fun/usagesWithImports.kt | 0 .../after/usages/usagesWithFqNames.java | 0 .../after/usages/usagesWithFqNames.kt | 0 .../after/usages/usagesWithImports.java | 0 .../after/usages/usagesWithImports.kt | 0 .../addQuotation/before/in/foo/fun/test.kt | 0 .../before/in/foo/fun/usagesWithFqNames.java | 0 .../before/in/foo/fun/usagesWithFqNames.kt | 0 .../before/in/foo/fun/usagesWithImports.java | 0 .../before/in/foo/fun/usagesWithImports.kt | 0 .../before/usages/usagesWithFqNames.java | 0 .../before/usages/usagesWithFqNames.kt | 0 .../before/usages/usagesWithImports.java | 0 .../before/usages/usagesWithImports.kt | 0 .../changeToDefaultPackage/after/test.kt | 0 .../after/usagesWithFqNames.java | 0 .../after/usagesWithFqNames.kt | 0 .../after/usagesWithImports.java | 0 .../after/usagesWithImports.kt | 0 .../changeToDefaultPackage/before/test.kt | 0 .../before/usagesWithFqNames.java | 0 .../before/usagesWithFqNames.kt | 0 .../before/usagesWithImports.java | 0 .../before/usagesWithImports.kt | 0 .../changeToDefaultPackage.test | 5 + .../after/target/test.kt | 0 .../after/target/usagesWithFqNames.java | 0 .../after/target/usagesWithFqNames.kt | 0 .../after/target/usagesWithImports.java | 0 .../after/target/usagesWithImports.kt | 0 .../after/usages/usagesWithFqNames.java | 0 .../after/usages/usagesWithFqNames.kt | 0 .../after/usages/usagesWithImports.java | 0 .../after/usages/usagesWithImports.kt | 0 .../before/target/test.kt | 0 .../before/target/usagesWithFqNames.java | 0 .../before/target/usagesWithFqNames.kt | 0 .../before/target/usagesWithImports.java | 0 .../before/target/usagesWithImports.kt | 0 .../before/usages/usagesWithFqNames.java | 0 .../before/usages/usagesWithFqNames.kt | 0 .../before/usages/usagesWithImports.java | 0 .../before/usages/usagesWithImports.kt | 0 .../changeToNonDefaultPackage.test | 5 + .../innerClass/after/foo/dependency.kt | 0 .../innerClass/after/foo/test.kt | 0 .../innerClass/before/foo/dependency.kt | 0 .../innerClass/before/foo/test.kt | 0 .../innerClass/innerClass.test | 5 + .../after/foo/bar/test.kt | 0 .../before/foo/bar/test.kt | 0 .../packageMatchesDirectory.test | 5 + .../AbstractLocalInspectionTest.kt | 37 ++++-- .../AbstractMultiFileLocalInspectionTest.kt | 84 ++++++++++++++ ...MultiFileLocalInspectionTestGenerated.java | 86 ++++++++++++++ .../MultiFileIntentionTestGenerated.java | 48 -------- 93 files changed, 343 insertions(+), 294 deletions(-) delete mode 100644 idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/after.kt.template delete mode 100644 idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/before.kt.template delete mode 100644 idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/description.html delete mode 100644 idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/after.kt.template delete mode 100644 idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/before.kt.template delete mode 100644 idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/description.html delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/ChangePackageToMatchDirectoryIntention.kt delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/MoveFileToPackageMatchingDirectoryIntention.kt delete mode 100644 idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test delete mode 100644 idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test delete mode 100644 idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test delete mode 100644 idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/addQuotation.test delete mode 100644 idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test delete mode 100644 idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test delete mode 100644 idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/innerClass.test delete mode 100644 idea/testData/multiFileIntentions/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/after/source/dummy.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/after/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/before/source/dummy.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/before/source/test.kt (100%) create mode 100644 idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/after/source/dummy.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/after/target/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/before/source/dummy.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/before/source/test.kt (100%) create mode 100644 idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/moveFileToPackageMatchingDirectory/packageMatchesDirectory/after/foo/bar/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/moveFileToPackageMatchingDirectory/packageMatchesDirectory/before/foo/bar/test.kt (100%) create mode 100644 idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test create mode 100644 idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/addQuotation.test rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithFqNames.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithFqNames.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithImports.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithImports.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithFqNames.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithFqNames.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithImports.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithImports.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithFqNames.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithFqNames.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithImports.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithImports.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithFqNames.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithFqNames.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithImports.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithImports.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToDefaultPackage/after/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithFqNames.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithFqNames.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithImports.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithImports.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToDefaultPackage/before/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithFqNames.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithFqNames.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithImports.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithImports.kt (100%) create mode 100644 idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithFqNames.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithFqNames.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithImports.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithImports.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithFqNames.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithFqNames.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithImports.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithImports.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithFqNames.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithFqNames.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithImports.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithImports.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithFqNames.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithFqNames.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithImports.java (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithImports.kt (100%) create mode 100644 idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/innerClass/after/foo/dependency.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/innerClass/after/foo/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/innerClass/before/foo/dependency.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/innerClass/before/foo/test.kt (100%) create mode 100644 idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/innerClass.test rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/packageMatchesDirectory/after/foo/bar/test.kt (100%) rename idea/testData/{multiFileIntentions => multiFileLocalInspections}/reconcilePackageWithDirectory/packageMatchesDirectory/before/foo/bar/test.kt (100%) create mode 100644 idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test create mode 100644 idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractMultiFileLocalInspectionTest.kt create mode 100644 idea/tests/org/jetbrains/kotlin/idea/inspections/MultiFileLocalInspectionTestGenerated.java diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index c6445c3aff3..af2eb38fed0 100755 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -99,6 +99,7 @@ import org.jetbrains.kotlin.idea.highlighter.* import org.jetbrains.kotlin.idea.imports.AbstractJsOptimizeImportsTest import org.jetbrains.kotlin.idea.imports.AbstractJvmOptimizeImportsTest import org.jetbrains.kotlin.idea.inspections.AbstractLocalInspectionTest +import org.jetbrains.kotlin.idea.inspections.AbstractMultiFileLocalInspectionTest import org.jetbrains.kotlin.idea.intentions.AbstractConcatenatedStringGeneratorTest import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest2 @@ -461,6 +462,10 @@ fun main(args: Array) { model("multiFileIntentions", extension = "test", singleClass = true, filenameStartsLowerCase = true) } + testClass { + model("multiFileLocalInspections", extension = "test", singleClass = true, filenameStartsLowerCase = true) + } + testClass { model("multiFileInspections", extension = "test", singleClass = true) } diff --git a/idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/after.kt.template b/idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/after.kt.template deleted file mode 100644 index 977183ecda7..00000000000 --- a/idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/after.kt.template +++ /dev/null @@ -1,8 +0,0 @@ -// File: bar/foo/test.kt -package bar.foo - -class MyClass: OtherClass { - fun myFun() { - - } -} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/before.kt.template b/idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/before.kt.template deleted file mode 100644 index 90bb6b33e0c..00000000000 --- a/idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/before.kt.template +++ /dev/null @@ -1,10 +0,0 @@ -// File: bar/foo/test.kt -package foo.bar - -import bar.foo.OtherClass - -class MyClass: OtherClass { - fun myFun() { - - } -} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/description.html b/idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/description.html deleted file mode 100644 index 78d5e42bf56..00000000000 --- a/idea/resources/intentionDescriptions/ChangePackageToMatchDirectoryIntention/description.html +++ /dev/null @@ -1,6 +0,0 @@ - - -This intention changes file's package directive so that it matches containing directory. -All import directives and usages are updated accordingly - - \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/after.kt.template b/idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/after.kt.template deleted file mode 100644 index 2124a2b6170..00000000000 --- a/idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/after.kt.template +++ /dev/null @@ -1,10 +0,0 @@ -// File: foo/bar/test.kt -package foo.bar - -import bar.foo.OtherClass - -class MyClass: OtherClass { - fun myFun() { - - } -} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/before.kt.template b/idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/before.kt.template deleted file mode 100644 index 90bb6b33e0c..00000000000 --- a/idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/before.kt.template +++ /dev/null @@ -1,10 +0,0 @@ -// File: bar/foo/test.kt -package foo.bar - -import bar.foo.OtherClass - -class MyClass: OtherClass { - fun myFun() { - - } -} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/description.html b/idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/description.html deleted file mode 100644 index afc744eb5df..00000000000 --- a/idea/resources/intentionDescriptions/MoveFileToPackageMatchingDirectoryIntention/description.html +++ /dev/null @@ -1,5 +0,0 @@ - - -This intention moves file to the directory matching its package directive. - - \ No newline at end of file diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index a985bb5dca4..3f179d9123f 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -1142,16 +1142,6 @@ Kotlin - - org.jetbrains.kotlin.idea.refactoring.move.changePackage.MoveFileToPackageMatchingDirectoryIntention - Kotlin - - - - org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageToMatchDirectoryIntention - Kotlin - - org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.MoveDeclarationToSeparateFileIntention Kotlin diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/ChangePackageToMatchDirectoryIntention.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/ChangePackageToMatchDirectoryIntention.kt deleted file mode 100644 index 58ec1df060d..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/ChangePackageToMatchDirectoryIntention.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.refactoring.move.changePackage - -import com.intellij.openapi.editor.Editor -import org.jetbrains.kotlin.idea.core.getFqNameByDirectory -import org.jetbrains.kotlin.idea.core.packageMatchesDirectory -import org.jetbrains.kotlin.idea.intentions.SelfTargetingOffsetIndependentIntention -import org.jetbrains.kotlin.idea.refactoring.hasIdentifiersOnly -import org.jetbrains.kotlin.idea.refactoring.isInjectedFragment -import org.jetbrains.kotlin.psi.KtPackageDirective - -class ChangePackageToMatchDirectoryIntention : SelfTargetingOffsetIndependentIntention( - KtPackageDirective::class.java, "", "Change file's package to match directory" -) { - override fun isApplicableTo(element: KtPackageDirective): Boolean { - val file = element.containingKtFile - if (file.isInjectedFragment || file.packageMatchesDirectory()) return false - - val fqNameByDirectory = file.getFqNameByDirectory() - text = if (!fqNameByDirectory.hasIdentifiersOnly()) { - "File package doesn't match directory (cannot fix)" - } - else { - "Change file's package to '${fqNameByDirectory.asString()}'" - } - return true - } - - override fun applyTo(element: KtPackageDirective, editor: Editor?) { - val file = element.containingKtFile - val newFqName = file.getFqNameByDirectory() - if (!newFqName.hasIdentifiersOnly()) return - KotlinChangePackageRefactoring(file).run(newFqName) - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/MoveFileToPackageMatchingDirectoryIntention.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/MoveFileToPackageMatchingDirectoryIntention.kt deleted file mode 100644 index 41f98a397ea..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/MoveFileToPackageMatchingDirectoryIntention.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.refactoring.move.changePackage - -import com.intellij.CommonBundle -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.roots.JavaProjectRootsUtil -import com.intellij.openapi.ui.Messages -import com.intellij.psi.PsiManager -import com.intellij.refactoring.PackageWrapper -import com.intellij.refactoring.move.moveClassesOrPackages.AutocreatingSingleSourceRootMoveDestination -import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesUtil -import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesUtil -import com.intellij.refactoring.util.RefactoringMessageUtil -import org.jetbrains.kotlin.idea.core.packageMatchesDirectory -import org.jetbrains.kotlin.idea.intentions.SelfTargetingOffsetIndependentIntention -import org.jetbrains.kotlin.idea.refactoring.isInsideInjectedFragment -import org.jetbrains.kotlin.idea.util.application.runWriteAction -import org.jetbrains.kotlin.psi.KtPackageDirective - -class MoveFileToPackageMatchingDirectoryIntention : SelfTargetingOffsetIndependentIntention( - KtPackageDirective::class.java, "", "Move file to package-matching directory" -) { - override fun isApplicableTo(element: KtPackageDirective): Boolean { - if (element.isInsideInjectedFragment) return false - if (element.containingKtFile.packageMatchesDirectory()) return false - - val qualifiedName = element.qualifiedName - val dirName = if (qualifiedName.isEmpty()) "source root" else "'${qualifiedName.replace('.', '/')}'" - text = "Move file to $dirName" - return true - } - - override fun startInWriteAction() = false - - override fun applyTo(element: KtPackageDirective, editor: Editor?) { - val file = element.containingKtFile - val project = file.project - - val sourceRoots = JavaProjectRootsUtil.getSuitableDestinationSourceRoots(project) - val packageWrapper = PackageWrapper(PsiManager.getInstance(project), element.qualifiedName) - val fileToMove = element.containingFile - val chosenRoot = - sourceRoots.singleOrNull() - ?: MoveClassesOrPackagesUtil.chooseSourceRoot(packageWrapper, sourceRoots, fileToMove.containingDirectory) - ?: return - val targetDirFactory = AutocreatingSingleSourceRootMoveDestination(packageWrapper, chosenRoot) - targetDirFactory.verify(fileToMove)?.let { - Messages.showMessageDialog(project, it, CommonBundle.getErrorTitle(), Messages.getErrorIcon()) - return - } - val targetDirectory = runWriteAction { - targetDirFactory.getTargetDirectory(fileToMove) - } ?: return - - RefactoringMessageUtil.checkCanCreateFile(targetDirectory, file.name)?.let { - Messages.showMessageDialog(project, it, CommonBundle.getErrorTitle(), Messages.getErrorIcon()) - return - } - - runWriteAction { - MoveFilesOrDirectoriesUtil.doMoveFile(file, targetDirectory) - } - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/PackageDirectoryMismatchInspection.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/PackageDirectoryMismatchInspection.kt index 4ea4d23658f..9a722b09c5d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/PackageDirectoryMismatchInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/PackageDirectoryMismatchInspection.kt @@ -16,12 +16,107 @@ package org.jetbrains.kotlin.idea.refactoring.move.changePackage -import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection +import com.intellij.CommonBundle +import com.intellij.codeInspection.* +import com.intellij.openapi.project.Project +import com.intellij.openapi.roots.JavaProjectRootsUtil +import com.intellij.openapi.ui.Messages +import com.intellij.psi.PsiManager +import com.intellij.refactoring.PackageWrapper +import com.intellij.refactoring.move.moveClassesOrPackages.AutocreatingSingleSourceRootMoveDestination +import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesUtil +import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesUtil +import com.intellij.refactoring.util.RefactoringMessageUtil +import org.jetbrains.kotlin.idea.core.getFqNameByDirectory +import org.jetbrains.kotlin.idea.core.packageMatchesDirectory +import org.jetbrains.kotlin.idea.inspections.AbstractKotlinInspection +import org.jetbrains.kotlin.idea.refactoring.hasIdentifiersOnly +import org.jetbrains.kotlin.idea.refactoring.isInjectedFragment +import org.jetbrains.kotlin.idea.util.application.runWriteAction +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtPackageDirective +import org.jetbrains.kotlin.psi.KtVisitorVoid -class PackageDirectoryMismatchInspection: IntentionBasedInspection( - listOf( - IntentionBasedInspection.IntentionData(MoveFileToPackageMatchingDirectoryIntention::class), - IntentionBasedInspection.IntentionData(ChangePackageToMatchDirectoryIntention::class)), - "Package directive doesn't match file location" -) \ No newline at end of file +class PackageDirectoryMismatchInspection : AbstractKotlinInspection() { + + override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession) = + object : KtVisitorVoid() { + override fun visitPackageDirective(directive: KtPackageDirective) { + super.visitPackageDirective(directive) + if (directive.text.isEmpty()) return + + val file = directive.containingKtFile + if (file.isInjectedFragment || file.packageMatchesDirectory()) return + + val fixes = mutableListOf() + val qualifiedName = directive.qualifiedName + val dirName = if (qualifiedName.isEmpty()) "source root" else "'${qualifiedName.replace('.', '/')}'" + fixes += MoveFileToPackageFix(dirName) + val fqNameByDirectory = file.getFqNameByDirectory() + if (fqNameByDirectory.hasIdentifiersOnly()) { + fixes += ChangePackageFix(fqNameByDirectory) + } + + holder.registerProblem( + directive, + "Package directive doesn't match file location", + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, + *fixes.toTypedArray() + ) + } + } + + private class MoveFileToPackageFix(val dirName: String) : LocalQuickFix { + override fun getFamilyName() = "Move file to package-matching directory" + + override fun getName() = "Move file to $dirName" + + override fun startInWriteAction() = false + + override fun applyFix(project: Project, descriptor: ProblemDescriptor) { + val directive = descriptor.psiElement as? KtPackageDirective ?: return + val file = directive.containingKtFile + + val sourceRoots = JavaProjectRootsUtil.getSuitableDestinationSourceRoots(project) + val packageWrapper = PackageWrapper(PsiManager.getInstance(project), directive.qualifiedName) + val fileToMove = directive.containingFile + val chosenRoot = + sourceRoots.singleOrNull() + ?: MoveClassesOrPackagesUtil.chooseSourceRoot(packageWrapper, sourceRoots, + fileToMove.containingDirectory) + ?: return + val targetDirFactory = AutocreatingSingleSourceRootMoveDestination(packageWrapper, chosenRoot) + targetDirFactory.verify(fileToMove)?.let { + Messages.showMessageDialog(project, it, CommonBundle.getErrorTitle(), Messages.getErrorIcon()) + return + } + val targetDirectory = runWriteAction { + targetDirFactory.getTargetDirectory(fileToMove) + } ?: return + + RefactoringMessageUtil.checkCanCreateFile(targetDirectory, file.name)?.let { + Messages.showMessageDialog(project, it, CommonBundle.getErrorTitle(), Messages.getErrorIcon()) + return + } + + runWriteAction { + MoveFilesOrDirectoriesUtil.doMoveFile(file, targetDirectory) + } + } + } + + private class ChangePackageFix(val fqNameByDirectory: FqName) : LocalQuickFix { + override fun getFamilyName() = "Change file's package to match directory" + + override fun getName() = "Change file's package to '${fqNameByDirectory.asString()}'" + + override fun applyFix(project: Project, descriptor: ProblemDescriptor) { + val directive = descriptor.psiElement as? KtPackageDirective ?: return + val file = directive.containingKtFile + val newFqName = file.getFqNameByDirectory() + if (!newFqName.hasIdentifiersOnly()) return + KotlinChangePackageRefactoring(file).run(newFqName) + + } + } +} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test b/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test deleted file mode 100644 index ded29b6f6b5..00000000000 --- a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test +++ /dev/null @@ -1,5 +0,0 @@ -{ - "mainFile": "source/test.kt", - "intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.MoveFileToPackageMatchingDirectoryIntention", - "intentionText": "Move file to source root" -} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test b/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test deleted file mode 100644 index 0e3b7c49114..00000000000 --- a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test +++ /dev/null @@ -1,5 +0,0 @@ -{ - "mainFile": "source/test.kt", - "intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.MoveFileToPackageMatchingDirectoryIntention", - "intentionText": "Move file to 'target'" -} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test b/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test deleted file mode 100644 index 5723dfed032..00000000000 --- a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test +++ /dev/null @@ -1,5 +0,0 @@ -{ - "intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.MoveFileToPackageMatchingDirectoryIntention", - "isApplicable": "false", - "mainFile": "foo/bar/test.kt" -} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/addQuotation.test b/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/addQuotation.test deleted file mode 100644 index 7147d551e4d..00000000000 --- a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/addQuotation.test +++ /dev/null @@ -1,5 +0,0 @@ -{ - "mainFile": "in/foo/fun/test.kt", - "intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageToMatchDirectoryIntention", - "intentionText": "Change file's package to 'in.foo.fun'" -} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test b/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test deleted file mode 100644 index 3f56d977d64..00000000000 --- a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test +++ /dev/null @@ -1,5 +0,0 @@ -{ - "mainFile": "test.kt", - "intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageToMatchDirectoryIntention", - "intentionText": "Change file's package to ''" -} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test b/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test deleted file mode 100644 index dcb861716c8..00000000000 --- a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test +++ /dev/null @@ -1,5 +0,0 @@ -{ - "mainFile": "target/test.kt", - "intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageToMatchDirectoryIntention", - "intentionText": "Change file's package to 'target'" -} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/innerClass.test b/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/innerClass.test deleted file mode 100644 index 1d0b01a4144..00000000000 --- a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/innerClass.test +++ /dev/null @@ -1,5 +0,0 @@ -{ - "intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageToMatchDirectoryIntention", - "isApplicable": "true", - "mainFile": "foo/test.kt" -} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test b/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test deleted file mode 100644 index 97b253542d4..00000000000 --- a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test +++ /dev/null @@ -1,5 +0,0 @@ -{ - "intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageToMatchDirectoryIntention", - "isApplicable": "false", - "mainFile": "foo/bar/test.kt" -} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/after/source/dummy.kt b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/after/source/dummy.kt similarity index 100% rename from idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/after/source/dummy.kt rename to idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/after/source/dummy.kt diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/after/test.kt b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/after/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/after/test.kt rename to idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/after/test.kt diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/before/source/dummy.kt b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/before/source/dummy.kt similarity index 100% rename from idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/before/source/dummy.kt rename to idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/before/source/dummy.kt diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/before/source/test.kt b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/before/source/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/before/source/test.kt rename to idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/before/source/test.kt diff --git a/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test new file mode 100644 index 00000000000..9b826406763 --- /dev/null +++ b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test @@ -0,0 +1,5 @@ +{ + "mainFile": "source/test.kt", + "inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection", + "fix": "Move file to source root" +} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/after/source/dummy.kt b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/after/source/dummy.kt similarity index 100% rename from idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/after/source/dummy.kt rename to idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/after/source/dummy.kt diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/after/target/test.kt b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/after/target/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/after/target/test.kt rename to idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/after/target/test.kt diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/before/source/dummy.kt b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/before/source/dummy.kt similarity index 100% rename from idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/before/source/dummy.kt rename to idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/before/source/dummy.kt diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/before/source/test.kt b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/before/source/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/before/source/test.kt rename to idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/before/source/test.kt diff --git a/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test new file mode 100644 index 00000000000..7e77785969c --- /dev/null +++ b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test @@ -0,0 +1,5 @@ +{ + "mainFile": "source/test.kt", + "inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection", + "fix": "Move file to 'target'" +} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/packageMatchesDirectory/after/foo/bar/test.kt b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/packageMatchesDirectory/after/foo/bar/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/packageMatchesDirectory/after/foo/bar/test.kt rename to idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/packageMatchesDirectory/after/foo/bar/test.kt diff --git a/idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/packageMatchesDirectory/before/foo/bar/test.kt b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/packageMatchesDirectory/before/foo/bar/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/packageMatchesDirectory/before/foo/bar/test.kt rename to idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/packageMatchesDirectory/before/foo/bar/test.kt diff --git a/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test new file mode 100644 index 00000000000..926c7b0912c --- /dev/null +++ b/idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test @@ -0,0 +1,5 @@ +{ + "inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection", + "problem": "none", + "mainFile": "foo/bar/test.kt" +} \ No newline at end of file diff --git a/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/addQuotation.test b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/addQuotation.test new file mode 100644 index 00000000000..0a8bfab7d16 --- /dev/null +++ b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/addQuotation.test @@ -0,0 +1,5 @@ +{ + "mainFile": "in/foo/fun/test.kt", + "inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection", + "fix": "Change file's package to 'in.foo.fun'" +} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/test.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/test.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/test.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithFqNames.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithFqNames.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithFqNames.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithFqNames.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithFqNames.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithFqNames.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithFqNames.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithFqNames.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithImports.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithImports.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithImports.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithImports.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithImports.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithImports.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithImports.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/in/foo/fun/usagesWithImports.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithFqNames.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithFqNames.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithFqNames.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithFqNames.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithFqNames.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithFqNames.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithFqNames.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithFqNames.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithImports.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithImports.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithImports.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithImports.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithImports.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithImports.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithImports.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/after/usages/usagesWithImports.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/test.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/test.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/test.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithFqNames.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithFqNames.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithFqNames.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithFqNames.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithFqNames.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithFqNames.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithFqNames.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithFqNames.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithImports.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithImports.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithImports.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithImports.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithImports.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithImports.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithImports.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/in/foo/fun/usagesWithImports.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithFqNames.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithFqNames.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithFqNames.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithFqNames.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithFqNames.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithFqNames.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithFqNames.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithFqNames.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithImports.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithImports.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithImports.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithImports.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithImports.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithImports.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithImports.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/before/usages/usagesWithImports.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/after/test.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/after/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/after/test.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/after/test.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithFqNames.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithFqNames.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithFqNames.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithFqNames.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithFqNames.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithFqNames.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithFqNames.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithFqNames.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithImports.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithImports.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithImports.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithImports.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithImports.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithImports.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithImports.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/after/usagesWithImports.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/before/test.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/before/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/before/test.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/before/test.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithFqNames.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithFqNames.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithFqNames.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithFqNames.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithFqNames.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithFqNames.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithFqNames.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithFqNames.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithImports.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithImports.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithImports.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithImports.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithImports.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithImports.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithImports.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/before/usagesWithImports.kt diff --git a/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test new file mode 100644 index 00000000000..4abd758fc9e --- /dev/null +++ b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test @@ -0,0 +1,5 @@ +{ + "mainFile": "test.kt", + "inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection", + "fix": "Change file's package to ''" +} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/test.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/test.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/test.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithFqNames.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithFqNames.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithFqNames.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithFqNames.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithFqNames.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithFqNames.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithFqNames.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithFqNames.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithImports.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithImports.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithImports.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithImports.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithImports.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithImports.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithImports.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/target/usagesWithImports.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithFqNames.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithFqNames.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithFqNames.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithFqNames.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithFqNames.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithFqNames.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithFqNames.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithFqNames.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithImports.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithImports.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithImports.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithImports.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithImports.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithImports.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithImports.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/after/usages/usagesWithImports.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/test.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/test.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/test.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithFqNames.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithFqNames.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithFqNames.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithFqNames.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithFqNames.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithFqNames.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithFqNames.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithFqNames.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithImports.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithImports.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithImports.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithImports.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithImports.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithImports.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithImports.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/target/usagesWithImports.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithFqNames.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithFqNames.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithFqNames.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithFqNames.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithFqNames.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithFqNames.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithFqNames.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithFqNames.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithImports.java b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithImports.java similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithImports.java rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithImports.java diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithImports.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithImports.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithImports.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/before/usages/usagesWithImports.kt diff --git a/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test new file mode 100644 index 00000000000..1978afd152d --- /dev/null +++ b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test @@ -0,0 +1,5 @@ +{ + "mainFile": "target/test.kt", + "inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection", + "fix": "Change file's package to 'target'" +} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/after/foo/dependency.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/after/foo/dependency.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/after/foo/dependency.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/after/foo/dependency.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/after/foo/test.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/after/foo/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/after/foo/test.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/after/foo/test.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/before/foo/dependency.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/before/foo/dependency.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/before/foo/dependency.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/before/foo/dependency.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/before/foo/test.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/before/foo/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/before/foo/test.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/before/foo/test.kt diff --git a/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/innerClass.test b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/innerClass.test new file mode 100644 index 00000000000..221f45f07e3 --- /dev/null +++ b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/innerClass.test @@ -0,0 +1,5 @@ +{ + "inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection", + "mainFile": "foo/test.kt", + "fix": "Change file's package to 'foo'" +} \ No newline at end of file diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/packageMatchesDirectory/after/foo/bar/test.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/packageMatchesDirectory/after/foo/bar/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/packageMatchesDirectory/after/foo/bar/test.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/packageMatchesDirectory/after/foo/bar/test.kt diff --git a/idea/testData/multiFileIntentions/reconcilePackageWithDirectory/packageMatchesDirectory/before/foo/bar/test.kt b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/packageMatchesDirectory/before/foo/bar/test.kt similarity index 100% rename from idea/testData/multiFileIntentions/reconcilePackageWithDirectory/packageMatchesDirectory/before/foo/bar/test.kt rename to idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/packageMatchesDirectory/before/foo/bar/test.kt diff --git a/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test new file mode 100644 index 00000000000..926c7b0912c --- /dev/null +++ b/idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test @@ -0,0 +1,5 @@ +{ + "inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection", + "problem": "none", + "mainFile": "foo/bar/test.kt" +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt index a4685103018..170f1c365bd 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt @@ -75,7 +75,7 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa return Class.forName(className).newInstance() as AbstractKotlinInspection } - protected fun doTest(path: String) { + protected open fun doTest(path: String) { val mainFile = File(path) val inspection = createInspection(mainFile) @@ -114,13 +114,14 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa } } - private fun doTestFor(mainFilePath: String, file: VirtualFile, inspection: AbstractKotlinInspection, fileText: String) { - val problemExpectedString = InTextDirectivesUtils.findStringWithPrefixes( - fileText, "// $expectedProblemDirectiveName: ") + protected fun runInspectionWithFixesAndCheck( + file: VirtualFile, + inspection: AbstractKotlinInspection, + problemExpectedString: String?, + highlightExpectedString: String?, + localFixTextString: String? + ): Boolean { val problemExpected = problemExpectedString == null || problemExpectedString != "none" - val highlightExpectedString = InTextDirectivesUtils.findStringWithPrefixes( - fileText, "// $expectedProblemHighlightType: ") - val presentation = runInspection(inspection, project, listOf(file)) val problemDescriptors = presentation.problemDescriptors .filterIsInstance() @@ -135,7 +136,7 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa else "Expected at least one problem at caret", problemExpected == problemDescriptors.isNotEmpty()) - if (!problemExpected) return + if (!problemExpected) return false if (problemExpectedString != null) { Assert.assertTrue("Expected the following problem at caret: $problemExpectedString\n" + "Active problems: ${problemDescriptors.joinToString { it.descriptionTemplate }}", @@ -147,9 +148,7 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa problemDescriptors.all { it.highlightType.toString() == highlightExpectedString }) } - val localFixTextString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// $fixTextDirectiveName: ") - val localFixActions = problemDescriptors.flatMap { - problem -> + val localFixActions = problemDescriptors.flatMap { problem -> val fixes = problem.fixes fixes?.toList() ?: emptyList() }.filter { fix -> localFixTextString == null || fix.name == localFixTextString } @@ -171,6 +170,21 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa project.executeWriteCommand(localFixAction!!.name, null) { localFixAction.applyFix(project, problemDescriptor) } + return true + } + + private fun doTestFor(mainFilePath: String, file: VirtualFile, inspection: AbstractKotlinInspection, fileText: String) { + val problemExpectedString = InTextDirectivesUtils.findStringWithPrefixes( + fileText, "// $expectedProblemDirectiveName: ") + val highlightExpectedString = InTextDirectivesUtils.findStringWithPrefixes( + fileText, "// $expectedProblemHighlightType: ") + val localFixTextString = InTextDirectivesUtils.findStringWithPrefixes( + fileText, "// $fixTextDirectiveName: ") + + if (!runInspectionWithFixesAndCheck(file, inspection, problemExpectedString, highlightExpectedString, localFixTextString)) { + return + } + val canonicalPathToExpectedFile = mainFilePath + afterFileNameSuffix try { myFixture.checkResultByFile(canonicalPathToExpectedFile) @@ -182,6 +196,7 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa ) } } + companion object { private val EXTENSIONS = arrayOf(".kt", ".kts", ".java", ".groovy") } diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractMultiFileLocalInspectionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractMultiFileLocalInspectionTest.kt new file mode 100644 index 00000000000..9f6c6426ee9 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/AbstractMultiFileLocalInspectionTest.kt @@ -0,0 +1,84 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.inspections + +import com.google.gson.JsonObject +import com.google.gson.JsonParser +import com.intellij.openapi.fileEditor.FileDocumentManager +import com.intellij.openapi.util.io.FileUtil +import com.intellij.openapi.vfs.LocalFileSystem +import com.intellij.openapi.vfs.VirtualFile +import com.intellij.psi.PsiDocumentManager +import com.intellij.testFramework.LightProjectDescriptor +import com.intellij.testFramework.PlatformTestUtil +import com.intellij.testFramework.UsefulTestCase +import junit.framework.TestCase +import org.jetbrains.kotlin.idea.jsonUtils.getString +import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor +import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor +import org.jetbrains.kotlin.test.KotlinTestUtils +import java.io.File + +abstract class AbstractMultiFileLocalInspectionTest : AbstractLocalInspectionTest() { + override fun getProjectDescriptor(): LightProjectDescriptor { + if (KotlinTestUtils.isAllFilesPresentTest(getTestName(false))) return super.getProjectDescriptor() + val testFile = File(testDataPath, fileName()) + val config = JsonParser().parse(FileUtil.loadFile(testFile, true)) as JsonObject + val withRuntime = config["withRuntime"]?.asBoolean ?: false + return if (withRuntime) + KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE + else + KotlinLightProjectDescriptor.INSTANCE + } + + override fun doTest(path: String) { + val testFile = File(path) + val config = JsonParser().parse(FileUtil.loadFile(testFile, true)) as JsonObject + + val mainFilePath = config.getString("mainFile") + val mainFile = File(testFile.parent, "before/$mainFilePath") + val mainFileText = FileUtil.loadFile(mainFile, true) + TestCase.assertTrue("\"\" is missing in file \"$mainFilePath\"", mainFileText.contains("")) + + val inspection = Class.forName(config.getString("inspectionClass")).newInstance() as AbstractKotlinInspection + val problemExpectedString = config["problem"]?.asString // null means "some problem", "none" means no problem + val localFixTextString = config["fix"]?.asString // null means "some single fix" or "none" if no problem expected + + doTest(path) test@ { _ -> + val mainFile = myFixture.configureFromTempProjectFile(mainFilePath) + + runInspectionWithFixesAndCheck(mainFile.virtualFile, inspection, problemExpectedString, null, localFixTextString) + } + } + + protected fun doTest(path: String, action: (VirtualFile) -> Unit) { + val beforeDir = path.removePrefix(testDataPath).substringBeforeLast('/') + "/before" + val beforeVFile = myFixture.copyDirectoryToProject(beforeDir, "") + PsiDocumentManager.getInstance(myFixture.project).commitAllDocuments() + + val afterDir = beforeDir.substringBeforeLast("/") + "/after" + val afterDirIOFile = File(testDataPath, afterDir) + val afterVFile = LocalFileSystem.getInstance().findFileByIoFile(afterDirIOFile)!! + UsefulTestCase.refreshRecursively(afterVFile) + + action(beforeVFile) + + PsiDocumentManager.getInstance(project).commitAllDocuments() + FileDocumentManager.getInstance().saveAllDocuments() + PlatformTestUtil.assertDirectoriesEqual(afterVFile, beforeVFile) + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/MultiFileLocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/MultiFileLocalInspectionTestGenerated.java new file mode 100644 index 00000000000..e9335c20ed4 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/MultiFileLocalInspectionTestGenerated.java @@ -0,0 +1,86 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.inspections; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/testData/multiFileLocalInspections") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class MultiFileLocalInspectionTestGenerated extends AbstractMultiFileLocalInspectionTest { + public void testAllFilesPresentInMultiFileLocalInspections() throws Exception { + KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClass(this.getClass(), new File("idea/testData/multiFileLocalInspections"), Pattern.compile("^(.+)\\.test$"), TargetBackend.ANY); + } + + @TestMetadata("moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test") + public void testMoveFileToPackageMatchingDirectory_moveToDefaultDirectory_MoveToDefaultDirectory() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test"); + doTest(fileName); + } + + @TestMetadata("moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test") + public void testMoveFileToPackageMatchingDirectory_moveToNonDefaultDirectory_MoveToNonDefaultDirectory() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test"); + doTest(fileName); + } + + @TestMetadata("moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test") + public void testMoveFileToPackageMatchingDirectory_packageMatchesDirectory_PackageMatchesDirectory() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileLocalInspections/moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test"); + doTest(fileName); + } + + @TestMetadata("reconcilePackageWithDirectory/addQuotation/addQuotation.test") + public void testReconcilePackageWithDirectory_addQuotation_AddQuotation() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/addQuotation/addQuotation.test"); + doTest(fileName); + } + + @TestMetadata("reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test") + public void testReconcilePackageWithDirectory_changeToDefaultPackage_ChangeToDefaultPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test"); + doTest(fileName); + } + + @TestMetadata("reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test") + public void testReconcilePackageWithDirectory_changeToNonDefaultPackage_ChangeToNonDefaultPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test"); + doTest(fileName); + } + + @TestMetadata("reconcilePackageWithDirectory/innerClass/innerClass.test") + public void testReconcilePackageWithDirectory_innerClass_InnerClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/innerClass.test"); + doTest(fileName); + } + + @TestMetadata("reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test") + public void testReconcilePackageWithDirectory_packageMatchesDirectory_PackageMatchesDirectory() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test"); + doTest(fileName); + } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/MultiFileIntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/MultiFileIntentionTestGenerated.java index d8977b0cbf9..e9115be972c 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/MultiFileIntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/MultiFileIntentionTestGenerated.java @@ -132,24 +132,6 @@ public class MultiFileIntentionTestGenerated extends AbstractMultiFileIntentionT doTest(fileName); } - @TestMetadata("moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test") - public void testMoveFileToPackageMatchingDirectory_moveToDefaultDirectory_MoveToDefaultDirectory() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToDefaultDirectory/moveToDefaultDirectory.test"); - doTest(fileName); - } - - @TestMetadata("moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test") - public void testMoveFileToPackageMatchingDirectory_moveToNonDefaultDirectory_MoveToNonDefaultDirectory() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/moveToNonDefaultDirectory/moveToNonDefaultDirectory.test"); - doTest(fileName); - } - - @TestMetadata("moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test") - public void testMoveFileToPackageMatchingDirectory_packageMatchesDirectory_PackageMatchesDirectory() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/moveFileToPackageMatchingDirectory/packageMatchesDirectory/packageMatchesDirectory.test"); - doTest(fileName); - } - @TestMetadata("moveOutOfCompanion/moveClass/moveClass.test") public void testMoveOutOfCompanion_moveClass_MoveClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/moveOutOfCompanion/moveClass/moveClass.test"); @@ -185,34 +167,4 @@ public class MultiFileIntentionTestGenerated extends AbstractMultiFileIntentionT String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/objectLiteralToLambda/objectLiteralToLambda.test"); doTest(fileName); } - - @TestMetadata("reconcilePackageWithDirectory/addQuotation/addQuotation.test") - public void testReconcilePackageWithDirectory_addQuotation_AddQuotation() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/reconcilePackageWithDirectory/addQuotation/addQuotation.test"); - doTest(fileName); - } - - @TestMetadata("reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test") - public void testReconcilePackageWithDirectory_changeToDefaultPackage_ChangeToDefaultPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToDefaultPackage/changeToDefaultPackage.test"); - doTest(fileName); - } - - @TestMetadata("reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test") - public void testReconcilePackageWithDirectory_changeToNonDefaultPackage_ChangeToNonDefaultPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/reconcilePackageWithDirectory/changeToNonDefaultPackage/changeToNonDefaultPackage.test"); - doTest(fileName); - } - - @TestMetadata("reconcilePackageWithDirectory/innerClass/innerClass.test") - public void testReconcilePackageWithDirectory_innerClass_InnerClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/innerClass.test"); - doTest(fileName); - } - - @TestMetadata("reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test") - public void testReconcilePackageWithDirectory_packageMatchesDirectory_PackageMatchesDirectory() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test"); - doTest(fileName); - } }