Do not insert parentheses into package directives
Add tests for "Move Package" refactoring
This commit is contained in:
@@ -650,6 +650,8 @@ public class JetPsiUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parentExpression instanceof JetPackageDirective) return false;
|
||||
|
||||
if (parentExpression instanceof JetWhenExpression || innerExpression instanceof JetWhenExpression) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package b.a
|
||||
|
||||
fun bar() {
|
||||
val t: A = A()
|
||||
foo()
|
||||
println(x)
|
||||
x = ""
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package b.a
|
||||
|
||||
import A as AA
|
||||
import foo as foofoo
|
||||
import x as xx
|
||||
|
||||
fun bar() {
|
||||
val t: AA = AA()
|
||||
foofoo()
|
||||
println(xx)
|
||||
xx = ""
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package b.a
|
||||
|
||||
public class A
|
||||
|
||||
public fun foo() { }
|
||||
|
||||
public var x = ""
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package b.a;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
A t = new A();
|
||||
APackage.foo();
|
||||
System.out.println(APackage.getX());
|
||||
APackage.setX("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package b.a
|
||||
|
||||
fun bar() {
|
||||
val t: A = A()
|
||||
foo()
|
||||
println(x)
|
||||
x = ""
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package b.a;
|
||||
|
||||
import static APackage.*;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
A t = new A();
|
||||
foo();
|
||||
System.out.println(getX());
|
||||
setX("");
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package b.a
|
||||
|
||||
import A as AA
|
||||
import foo as foofoo
|
||||
import x as xx
|
||||
|
||||
fun bar() {
|
||||
val t: AA = AA()
|
||||
foofoo()
|
||||
println(xx)
|
||||
xx = ""
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package b.a;
|
||||
|
||||
import static APackage.foo;
|
||||
import static APackage.getX;
|
||||
import static APackage.setX;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
A t = new A();
|
||||
foo();
|
||||
System.out.println(getX());
|
||||
setX("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package c;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
b.a.A t = new b.a.A();
|
||||
b.a.APackage.foo();
|
||||
System.out.println(b.a.APackage.getX());
|
||||
b.a.APackage.setX("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package c
|
||||
|
||||
import b.a.A
|
||||
import b.a
|
||||
|
||||
fun bar() {
|
||||
val t: A = A()
|
||||
a.foo()
|
||||
println(a.x)
|
||||
a.x = ""
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package c;
|
||||
|
||||
import b.a.*;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
A t = new A();
|
||||
APackage.foo();
|
||||
System.out.println(APackage.getX());
|
||||
APackage.setX("");
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package c
|
||||
|
||||
import b.a.*
|
||||
|
||||
fun bar() {
|
||||
val t: A = A()
|
||||
foo()
|
||||
println(x)
|
||||
x = ""
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package c;
|
||||
|
||||
import static b.a.APackage.*;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
b.a.A t = new b.a.A();
|
||||
foo();
|
||||
System.out.println(getX());
|
||||
setX("");
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package c;
|
||||
|
||||
import b.a.A;
|
||||
import b.a.APackage;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
A t = new A();
|
||||
APackage.foo();
|
||||
System.out.println(APackage.getX());
|
||||
APackage.setX("");
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package c
|
||||
|
||||
import b.a.A
|
||||
import b.a.foo
|
||||
import b.a.x
|
||||
|
||||
fun bar() {
|
||||
val t: A = A()
|
||||
foo()
|
||||
println(x)
|
||||
x = ""
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package c
|
||||
|
||||
import b.a.A as AA
|
||||
import b.a.foo as foofoo
|
||||
import b.a.x as xx
|
||||
|
||||
fun bar() {
|
||||
val t: AA = AA()
|
||||
foofoo()
|
||||
println(xx)
|
||||
xx = ""
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package c;
|
||||
|
||||
import static b.a.APackage.foo;
|
||||
import static b.a.APackage.getX;
|
||||
import static b.a.APackage.setX;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
b.a.A t = new b.a.A();
|
||||
foo();
|
||||
System.out.println(getX());
|
||||
setX("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package a
|
||||
|
||||
fun bar() {
|
||||
val t: A = A()
|
||||
foo()
|
||||
println(x)
|
||||
x = ""
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package a
|
||||
|
||||
import A as AA
|
||||
import foo as foofoo
|
||||
import x as xx
|
||||
|
||||
fun bar() {
|
||||
val t: AA = AA()
|
||||
foofoo()
|
||||
println(xx)
|
||||
xx = ""
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package a
|
||||
|
||||
public class A
|
||||
|
||||
public fun foo() { }
|
||||
|
||||
public var x = ""
|
||||
@@ -0,0 +1,10 @@
|
||||
package a;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
A t = new A();
|
||||
APackage.foo();
|
||||
System.out.println(APackage.getX());
|
||||
APackage.setX("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package a
|
||||
|
||||
fun bar() {
|
||||
val t: A = A()
|
||||
foo()
|
||||
println(x)
|
||||
x = ""
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package a;
|
||||
|
||||
import static APackage.*;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
A t = new A();
|
||||
foo();
|
||||
System.out.println(getX());
|
||||
setX("");
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package a
|
||||
|
||||
import A as AA
|
||||
import foo as foofoo
|
||||
import x as xx
|
||||
|
||||
fun bar() {
|
||||
val t: AA = AA()
|
||||
foofoo()
|
||||
println(xx)
|
||||
xx = ""
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package a;
|
||||
|
||||
import static APackage.foo;
|
||||
import static APackage.getX;
|
||||
import static APackage.setX;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
A t = new A();
|
||||
foo();
|
||||
System.out.println(getX());
|
||||
setX("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package c;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
a.A t = new a.A();
|
||||
a.APackage.foo();
|
||||
System.out.println(a.APackage.getX());
|
||||
a.APackage.setX("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package c
|
||||
|
||||
fun bar() {
|
||||
val t: a.A = a.A()
|
||||
a.foo()
|
||||
println(a.x)
|
||||
a.x = ""
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package c;
|
||||
|
||||
import a.*;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
A t = new A();
|
||||
APackage.foo();
|
||||
System.out.println(APackage.getX());
|
||||
APackage.setX("");
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package c
|
||||
|
||||
import a.*
|
||||
|
||||
fun bar() {
|
||||
val t: A = A()
|
||||
foo()
|
||||
println(x)
|
||||
x = ""
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package c;
|
||||
|
||||
import static a.APackage.*;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
a.A t = new a.A();
|
||||
foo();
|
||||
System.out.println(getX());
|
||||
setX("");
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package c;
|
||||
|
||||
import a.A;
|
||||
import a.APackage;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
A t = new A();
|
||||
APackage.foo();
|
||||
System.out.println(APackage.getX());
|
||||
APackage.setX("");
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package c
|
||||
|
||||
import a.A
|
||||
import a.foo
|
||||
import a.x
|
||||
|
||||
fun bar() {
|
||||
val t: A = A()
|
||||
foo()
|
||||
println(x)
|
||||
x = ""
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package c
|
||||
|
||||
import a.A as AA
|
||||
import a.foo as foofoo
|
||||
import a.x as xx
|
||||
|
||||
fun bar() {
|
||||
val t: AA = AA()
|
||||
foofoo()
|
||||
println(xx)
|
||||
xx = ""
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package c;
|
||||
|
||||
import static a.APackage.foo;
|
||||
import static a.APackage.getX;
|
||||
import static a.APackage.setX;
|
||||
|
||||
class J {
|
||||
void bar() {
|
||||
a.A t = new a.A();
|
||||
foo();
|
||||
System.out.println(getX());
|
||||
setX("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"mainFile": "a/main.kt",
|
||||
"type": "MOVE_PACKAGES",
|
||||
"sourcePackage": "a",
|
||||
"targetPackage": "b"
|
||||
}
|
||||
@@ -171,4 +171,9 @@ public class JetMoveTestGenerated extends AbstractJetMoveTest {
|
||||
doTest("idea/testData/refactoring/move/java/movePackage/movePackageToAnotherPackage/movePackageToAnotherPackage.test");
|
||||
}
|
||||
|
||||
@TestMetadata("kotlin/movePackage/movePackage/movePackage.test")
|
||||
public void testKotlin_movePackage_movePackage_MovePackage() throws Exception {
|
||||
doTest("idea/testData/refactoring/move/kotlin/movePackage/movePackage/movePackage.test");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user