diff --git a/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/main.java b/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/main.java index 57edca5a657..5d4b8236d96 100644 --- a/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/main.java +++ b/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/main.java @@ -1,9 +1,9 @@ public class A { - public static class X { - - } } public class B { + private static class X { + + } } \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/noImports.kt b/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/noImports.kt index fd8f27738f6..8b616b22226 100644 --- a/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/noImports.kt +++ b/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/noImports.kt @@ -1,3 +1,3 @@ fun bar(s: String) { - val t: A.X = A.X() + val t: B.X = B.X() } \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/onDemandImport.kt b/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/onDemandImport.kt index 69926dd5d39..7b1bf28b928 100644 --- a/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/onDemandImport.kt +++ b/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/onDemandImport.kt @@ -1,5 +1,5 @@ import A.* fun bar(s: String) { - val t: X = X() + val t: B.X = B.X() } \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/specificImport.kt b/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/specificImport.kt index cb131d7aca3..4050f1fe825 100644 --- a/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/specificImport.kt +++ b/idea/testData/refactoring/move/java/moveClass/moveAsMember/moveClassToTopLevelClassAndMakePrivate/after/specificImport.kt @@ -1,4 +1,4 @@ -import A.X as XX +import B.X as XX fun bar(s: String) { val t: XX = XX() diff --git a/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/main.java b/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/main.java index b8eea268079..c75bb3f1c05 100644 --- a/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/main.java +++ b/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/main.java @@ -1,7 +1,7 @@ public class A { - public static String X = ""; } public class B { + private static String X = ""; } \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/noImports.kt b/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/noImports.kt index 910678f8afd..1e1f02f6022 100644 --- a/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/noImports.kt +++ b/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/noImports.kt @@ -1,3 +1,3 @@ fun bar(s: String) { - A.X = s + B.X = s } \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/onDemandImport.kt b/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/onDemandImport.kt index c1ff67a2ef8..356620c65f6 100644 --- a/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/onDemandImport.kt +++ b/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/onDemandImport.kt @@ -1,5 +1,5 @@ import A.* fun bar(s: String) { - X = s + B.X = s } \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/specificImport.kt b/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/specificImport.kt index a8f95cb7aa2..6349c07596f 100644 --- a/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/specificImport.kt +++ b/idea/testData/refactoring/move/java/moveField/moveFieldToTopLevelClassAndMakePrivate/after/specificImport.kt @@ -1,4 +1,4 @@ -import A.X as XX +import B.X as XX fun bar(s: String) { XX = s diff --git a/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/main.java b/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/main.java index 4e4f531332d..11e9d30c7f4 100644 --- a/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/main.java +++ b/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/main.java @@ -1,9 +1,9 @@ public class A { - public static void foo(String s) { - System.out.println(s) - } } public class B { + private static void foo(String s) { + System.out.println(s) + } } \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/noImports.kt b/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/noImports.kt index 637277334f8..d0952c2bea5 100644 --- a/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/noImports.kt +++ b/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/noImports.kt @@ -1,3 +1,3 @@ fun bar(s: String) { - A.foo(s) + B.foo(s) } \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/onDemandImport.kt b/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/onDemandImport.kt index ba053a3026d..8d1c9fa74f7 100644 --- a/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/onDemandImport.kt +++ b/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/onDemandImport.kt @@ -1,5 +1,5 @@ import A.* fun bar(s: String) { - foo(s) + B.foo(s) } \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/specificImport.kt b/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/specificImport.kt index 710c6f58a12..1002d124589 100644 --- a/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/specificImport.kt +++ b/idea/testData/refactoring/move/java/moveMethod/moveMethodToTopLevelClassAndMakePrivate/after/specificImport.kt @@ -1,4 +1,4 @@ -import A.foo as foofoo +import B.foo as foofoo fun bar(s: String) { foofoo(s) diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/after/C.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/after/C.kt new file mode 100644 index 00000000000..108e06deb53 --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/after/C.kt @@ -0,0 +1,8 @@ +package test + +class C(private val a: A.B) { + fun test() { + OuterOuterY() + this@A.OuterOuterY() + } +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/after/test.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/after/test.kt index ad7c5d8634c..4b427ac3467 100644 --- a/idea/testData/refactoring/move/kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/after/test.kt +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/after/test.kt @@ -4,11 +4,5 @@ class A { inner class OuterOuterY inner class B { - inner class C { - fun test() { - OuterOuterY() - this@A.OuterOuterY() - } - } } } \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/deepPrivateClass/after/main.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/deepPrivateClass/after/main.kt index 4dd9b8ebcac..4c06e777321 100644 --- a/idea/testData/refactoring/move/kotlin/moveNestedClass/deepPrivateClass/after/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/deepPrivateClass/after/main.kt @@ -2,8 +2,9 @@ class A { private class B { private class D - private class C { - private val d = D() - } + } + + private class C { + private val d = B.D() } } \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/deepProtectedClass/after/main.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/deepProtectedClass/after/main.kt index c791ea4e0db..aadb52a2386 100644 --- a/idea/testData/refactoring/move/kotlin/moveNestedClass/deepProtectedClass/after/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/deepProtectedClass/after/main.kt @@ -2,12 +2,13 @@ class A { open class B { protected class D - protected class C { - private val d = D() - } + } + + protected class C { + private val d = B.D() } } class X : A.B() { - private val c = A.B.C() + private val c = A.C() } \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/innerToTopLevelWithThisOuterRefConflicts/after/Y.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/innerToTopLevelWithThisOuterRefConflicts/after/Y.kt new file mode 100644 index 00000000000..a921861e260 --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/innerToTopLevelWithThisOuterRefConflicts/after/Y.kt @@ -0,0 +1,9 @@ +package test + +class Y(private val a: X) { + fun test() { + 1.foo() + with(1) { foo() } + with(A()) { bar() } + } +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/innerToTopLevelWithThisOuterRefConflicts/after/test.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/innerToTopLevelWithThisOuterRefConflicts/after/test.kt index 097f1b07216..310e701b5ef 100644 --- a/idea/testData/refactoring/move/kotlin/moveNestedClass/innerToTopLevelWithThisOuterRefConflicts/after/test.kt +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/innerToTopLevelWithThisOuterRefConflicts/after/test.kt @@ -9,11 +9,4 @@ class A() { class X { fun Int.foo() {} - inner class Y { - fun test() { - 1.foo() - with(1) { foo() } - with(A()) { bar() } - } - } } \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/nonInnerToTopLevelCompanionConflict/after/B.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/nonInnerToTopLevelCompanionConflict/after/B.kt new file mode 100644 index 00000000000..dc6a361d844 --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/nonInnerToTopLevelCompanionConflict/after/B.kt @@ -0,0 +1,7 @@ +package test + +class B { + fun test() { + 1.extFoo(1.extBar) + } +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/nonInnerToTopLevelCompanionConflict/after/test.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/nonInnerToTopLevelCompanionConflict/after/test.kt index d6f8cf59a1e..bc4ce9b166b 100644 --- a/idea/testData/refactoring/move/kotlin/moveNestedClass/nonInnerToTopLevelCompanionConflict/after/test.kt +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/nonInnerToTopLevelCompanionConflict/after/test.kt @@ -7,9 +7,4 @@ class A { val Int.extBar: Int get() = 1 } - class B { - fun test() { - 1.extFoo(1.extBar) - } - } } \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/privateClass/after/B.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/privateClass/after/B.kt new file mode 100644 index 00000000000..e19e0727fa0 --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/privateClass/after/B.kt @@ -0,0 +1,3 @@ +private class B { + private val c = A.C() +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/privateClass/after/main.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/privateClass/after/main.kt index e062cc3b497..da518f292ed 100644 --- a/idea/testData/refactoring/move/kotlin/moveNestedClass/privateClass/after/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/privateClass/after/main.kt @@ -1,9 +1,5 @@ class A { private val a = B() - private class B { - private val c = C() - } - private class C() } \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/protectedClass/after/B.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/protectedClass/after/B.kt new file mode 100644 index 00000000000..ed98e5e667c --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/protectedClass/after/B.kt @@ -0,0 +1,3 @@ +class B { + private val c = A.C() +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveNestedClass/protectedClass/after/main.kt b/idea/testData/refactoring/move/kotlin/moveNestedClass/protectedClass/after/main.kt index 6cb0f91bc3d..17650728f97 100644 --- a/idea/testData/refactoring/move/kotlin/moveNestedClass/protectedClass/after/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveNestedClass/protectedClass/after/main.kt @@ -1,10 +1,6 @@ open class A { private val a = B() - protected class B { - private val c = C() - } - protected class C() } diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/A/src/a1/dummy.txt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/A/src/a1/dummy.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/A/src/a2/internalSource.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/A/src/a2/internalSource.kt index 6ca006a1306..8e6bf6b314a 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/A/src/a2/internalSource.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/A/src/a2/internalSource.kt @@ -1,5 +1,5 @@ package a2 -import a1.internalTargetVal +import b.internalTargetVal -internal val sourceVal = internalTargetVal \ No newline at end of file +internal val sourceVal = b.internalTargetVal \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/A/src/a1/internalTarget.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/B/src/b/internalTarget.kt similarity index 76% rename from idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/A/src/a1/internalTarget.kt rename to idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/B/src/b/internalTarget.kt index e1d989c6551..047e94708c9 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/A/src/a1/internalTarget.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/after/B/src/b/internalTarget.kt @@ -1,3 +1,3 @@ -package a1 +package b internal val internalTargetVal = 0 \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/before/A/src/a1/dummy.txt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveFileWithDeclarationsToUnrelatedModuleConflict/before/A/src/a1/dummy.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveToUnrelatedModuleConflict/after/A/src/a/test.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveToUnrelatedModuleConflict/after/A/src/a/test.kt index 0b96cab78f4..807e1598f91 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveToUnrelatedModuleConflict/after/A/src/a/test.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveToUnrelatedModuleConflict/after/A/src/a/test.kt @@ -1,4 +1,3 @@ package a -val val1 = 0 -val val2 = val1 \ No newline at end of file +val val2 = target.val1 \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveToUnrelatedModuleConflict/after/B/src/target/val1.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveToUnrelatedModuleConflict/after/B/src/target/val1.kt new file mode 100644 index 00000000000..4231a6ea75d --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/moveToUnrelatedModuleConflict/after/B/src/target/val1.kt @@ -0,0 +1,3 @@ +package target + +val val1 = 0 \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/A/src/a1/dummy.txt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/A/src/a1/dummy.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/A/src/a2/internalSource.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/A/src/a2/internalSource.kt index a76eda225e4..7a24f3edbf4 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/A/src/a2/internalSource.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/A/src/a2/internalSource.kt @@ -1,3 +1,3 @@ package a2 -import a1.internalTargetVal \ No newline at end of file +import b.internalTargetVal \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/A/src/a1/internalTarget.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/B/src/b/internalTarget.kt similarity index 76% rename from idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/A/src/a1/internalTarget.kt rename to idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/B/src/b/internalTarget.kt index e1d989c6551..047e94708c9 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/A/src/a1/internalTarget.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/after/B/src/b/internalTarget.kt @@ -1,3 +1,3 @@ -package a1 +package b internal val internalTargetVal = 0 \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/before/A/src/a1/dummy.txt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/visibilityConflictInImport/before/A/src/a1/dummy.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/main.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/main.kt index b4e742eac3d..67ce513ad9b 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/main.kt @@ -1,7 +1,2 @@ package a -private class Test { - fun test { - foo(Foo()) - } -} diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/noImports.java b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/noImports.java index 315818ca8fd..c5fa6db1721 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/noImports.java +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/noImports.java @@ -1,5 +1,7 @@ package a; +import b.Test; + class J { void bar() { Test t = new Test(); diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/noImports.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/noImports.kt index 92ae90f968f..acbf910e155 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/noImports.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/a/noImports.kt @@ -1,5 +1,7 @@ package a +import b.Test + fun bar() { val t: Test = Test() } diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/b/Test.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/b/Test.kt new file mode 100644 index 00000000000..f2999f9ea81 --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackageWithConflicts/after/b/Test.kt @@ -0,0 +1,10 @@ +package b + +import a.Foo +import a.foo + +private class Test { + fun test { + foo(Foo()) + } +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/main.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/main.kt index 8564564226f..67ce513ad9b 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/main.kt @@ -1,5 +1,2 @@ package a -private fun test() { - foo(Foo()) -} diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/noImports.java b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/noImports.java index 9cc12698d1e..2219158ca07 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/noImports.java +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/noImports.java @@ -1,7 +1,9 @@ package a; +import b.TestKt; + class J { void bar() { - MainKt.test(); + TestKt.test(); } } diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/noImports.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/noImports.kt index 4c10813ba46..576a8bd2bee 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/noImports.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/a/noImports.kt @@ -1,5 +1,7 @@ package a +import b.test + fun bar() { test() } diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/b/test.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/b/test.kt new file mode 100644 index 00000000000..3efba0bd780 --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveFunctionToPackageWithConflicts/after/b/test.kt @@ -0,0 +1,8 @@ +package b + +import a.Foo +import a.foo + +private fun test() { + foo(Foo()) +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/main.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/main.kt index fcecce027c2..67ce513ad9b 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/main.kt @@ -1,7 +1,2 @@ package a -private object Test { - fun test { - foo(Foo()) - } -} diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/noImports.java b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/noImports.java index a141c4afb54..c1177df3c95 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/noImports.java +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/noImports.java @@ -1,5 +1,7 @@ package a; +import b.Test; + class J { void bar() { Test t = Test.INSTANCE; diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/noImports.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/noImports.kt index 2fd128dfb13..33627bd785b 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/noImports.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/a/noImports.kt @@ -1,5 +1,7 @@ package a +import b.Test + fun bar() { val t: Test = Test } diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/b/Test.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/b/Test.kt new file mode 100644 index 00000000000..0e2fbbf035f --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveObjectToPackageWithConflicts/after/b/Test.kt @@ -0,0 +1,10 @@ +package b + +import a.Foo +import a.foo + +private object Test { + fun test { + foo(Foo()) + } +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateClassWithUsagesInBothAccessors/after/target.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateClassWithUsagesInBothAccessors/after/target.kt index 761254b6c6f..84c789e6b5f 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateClassWithUsagesInBothAccessors/after/target.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateClassWithUsagesInBothAccessors/after/target.kt @@ -1 +1,3 @@ -package test \ No newline at end of file +package test + +private class TempY \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateClassWithUsagesInBothAccessors/after/test.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateClassWithUsagesInBothAccessors/after/test.kt index a76463d61d3..2b96f636608 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateClassWithUsagesInBothAccessors/after/test.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateClassWithUsagesInBothAccessors/after/test.kt @@ -1,7 +1,7 @@ package test -private class TempY - var tempY: Int = 0 - get() { TempY(); return field } - set(p: Int) { TempY(); field = p } \ No newline at end of file + get() { + TempY(); return field } + set(p: Int) { + TempY(); field = p } \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateFun/after/main.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateFun/after/main.kt index 733ef09ac96..1d3bec2afb6 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateFun/after/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateFun/after/main.kt @@ -1,9 +1,5 @@ package a -private fun foo() { - bar() -} - private fun bar() { foo() } \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateFun/after/utils.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateFun/after/utils.kt index 2f15c6d4702..eba2c9e667b 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateFun/after/utils.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateFun/after/utils.kt @@ -1,3 +1,7 @@ package a -object Utils \ No newline at end of file +object Utils + +private fun foo() { + bar() +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateProperty/after/main.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateProperty/after/main.kt index 03d426ceea7..f7235d47556 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateProperty/after/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateProperty/after/main.kt @@ -1,7 +1,4 @@ package a -private val foo: Int - get() = bar - private val bar: Int get() = foo \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateProperty/after/utils.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateProperty/after/utils.kt index 2f15c6d4702..063c3cf000b 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateProperty/after/utils.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivateProperty/after/utils.kt @@ -1,3 +1,6 @@ package a -object Utils \ No newline at end of file +object Utils + +private val foo: Int + get() = bar \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivatePropertyWithDefaultAccessors/after/main.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivatePropertyWithDefaultAccessors/after/main.kt index da1556ad1a9..67b94ed3805 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivatePropertyWithDefaultAccessors/after/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivatePropertyWithDefaultAccessors/after/main.kt @@ -1,4 +1,3 @@ package a -private val used: Int = 2 val using: Int = used + 1 \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivatePropertyWithDefaultAccessors/after/utils.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivatePropertyWithDefaultAccessors/after/utils.kt index 2f15c6d4702..95d86ae310f 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivatePropertyWithDefaultAccessors/after/utils.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePrivatePropertyWithDefaultAccessors/after/utils.kt @@ -1,3 +1,5 @@ package a -object Utils \ No newline at end of file +object Utils + +private val used: Int = 2 \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/main.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/main.kt index 7e671d14d74..67ce513ad9b 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/main.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/main.kt @@ -1,7 +1,2 @@ package a -private var test: String - get() = "" - set(value: String) { - foo(Foo()) - } diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/noImports.java b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/noImports.java index 083aa86c198..362e5fd1b83 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/noImports.java +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/noImports.java @@ -1,8 +1,10 @@ package a; +import b.TestKt; + class J { void bar() { - MainKt.setTest(""); - System.out.println(MainKt.getTest()); + TestKt.setTest(""); + System.out.println(TestKt.getTest()); } } diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/noImports.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/noImports.kt index f319c15486f..c7d1ea8ff44 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/noImports.kt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/a/noImports.kt @@ -1,5 +1,7 @@ package a +import b.test + fun bar() { test = "" println(test) diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/b/test.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/b/test.kt new file mode 100644 index 00000000000..8af50b1b4a9 --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/movePropertyToPackageWithConflicts/after/b/test.kt @@ -0,0 +1,10 @@ +package b + +import a.Foo +import a.foo + +private var test: String + get() = "" + set(value: String) { + foo(Foo()) + } \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/AbstractMoveTest.kt b/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/AbstractMoveTest.kt index bad2a9b41a3..6babc35b8f5 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/AbstractMoveTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/AbstractMoveTest.kt @@ -26,12 +26,10 @@ import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.* import com.intellij.refactoring.BaseRefactoringProcessor.ConflictsInTestsException +import com.intellij.refactoring.MoveDestination import com.intellij.refactoring.PackageWrapper import com.intellij.refactoring.move.MoveHandler -import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassToInnerProcessor -import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesProcessor -import com.intellij.refactoring.move.moveClassesOrPackages.MoveDirectoryWithClassesProcessor -import com.intellij.refactoring.move.moveClassesOrPackages.MultipleRootsMoveDestination +import com.intellij.refactoring.move.moveClassesOrPackages.* import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesProcessor import com.intellij.refactoring.move.moveInner.MoveInnerProcessor import com.intellij.refactoring.move.moveMembers.MockMoveMembersOptions @@ -98,8 +96,15 @@ abstract class AbstractMoveTest : KotlinMultiFileTestCase() { } catch(e: ConflictsInTestsException) { KotlinTestUtils.assertEqualsToFile(conflictFile, e.messages.sorted().joinToString("\n")) + + ConflictsInTestsException.setTestIgnore(true) + + // Run refactoring again with ConflictsInTestsException suppressed + action.runRefactoring(rootDir, mainPsiFile, elementAtCaret, config) } finally { + ConflictsInTestsException.setTestIgnore(false) + PsiDocumentManager.getInstance(project!!).commitAllDocuments() FileDocumentManager.getInstance().saveAllDocuments() @@ -270,15 +275,18 @@ enum class MoveAction { val moveTarget = config.getNullableString("targetPackage")?.let { packageName -> val targetSourceRootPath = config["targetSourceRoot"]?.asString - val moveDestination = MultipleRootsMoveDestination(PackageWrapper(mainFile.getManager(), packageName)) + val packageWrapper = PackageWrapper(mainFile.getManager(), packageName) + val moveDestination: MoveDestination = targetSourceRootPath?.let { + AutocreatingSingleSourceRootMoveDestination(packageWrapper, rootDir.findFileByRelativePath(it)!!) + } ?: MultipleRootsMoveDestination(packageWrapper) val targetDir = moveDestination.getTargetIfExists(mainFile) - val targetSourceRoot = if (targetSourceRootPath != null) { + val targetVirtualFile = if (targetSourceRootPath != null) { rootDir.findFileByRelativePath(targetSourceRootPath)!! } else { targetDir?.virtualFile } - KotlinMoveTargetForDeferredFile(FqName(packageName), targetDir, targetSourceRoot) { + KotlinMoveTargetForDeferredFile(FqName(packageName), targetDir, targetVirtualFile) { createKotlinFile(guessNewFileName(listOf(elementToMove))!!, moveDestination.getTargetDirectory(mainFile)) } } ?: config.getString("targetFile").let { filePath ->