Move: Force package name change when moving Java files

Package statement in Java file is updated too late
when moving the entire containing directory, so we force it
with intercepting MoveFileHandler implementation
This commit is contained in:
Alexey Sedunov
2017-04-07 17:35:43 +03:00
parent 3007b11973
commit 358b5fe548
19 changed files with 180 additions and 8 deletions
@@ -0,0 +1,9 @@
package test.pack
import test2.pack.A
import test2.pack.J
class Foo {
val a = A()
val j = J()
}
@@ -0,0 +1,5 @@
package test2
import test.pack.Foo
val foo = Foo()
@@ -0,0 +1,12 @@
package test2.pack;
import test.*;
import test.pack.Foo;
public class J {
A a = new A();
B b = new B();
C c = new C();
Foo foo = new Foo();
Bar bar = new Bar();
}
@@ -0,0 +1,17 @@
package test2.pack
import test.Bar
import test.pack.Foo
class A {
val b = B()
}
class B {
val a = A()
}
class C {
internal val foo = Foo()
internal val bar = Bar()
}
@@ -0,0 +1,6 @@
package test.pack
class Foo {
val a = A()
val j = J()
}
@@ -0,0 +1,5 @@
package test
import test.pack.Foo
val foo = Foo()
@@ -0,0 +1,11 @@
package test.pack;
import test.*;
public class J {
A a = new A();
B b = new B();
C c = new C();
Foo foo = new Foo();
Bar bar = new Bar();
}
@@ -0,0 +1,16 @@
package test.pack
import test.Bar
class A {
val b = B()
}
class B {
val a = A()
}
class C {
internal val foo = Foo()
internal val bar = Bar()
}
@@ -0,0 +1,5 @@
{
"filesToMove": ["test/FooUsage.kt", "test/pack"],
"type": "MOVE_FILES_WITH_DECLARATIONS",
"targetDirectory": "test2"
}