Move: Implement inspection which reports mismatch between package directive and containing directory
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
package bar
|
||||
|
||||
class Foo {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package foo
|
||||
|
||||
class Foo {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>barPackageMismatched.kt</file>
|
||||
<line>1</line>
|
||||
<module>testPackageDirectoryMismatch_PackageDirectoryMismatch_0</module>
|
||||
<entry_point TYPE="file" FQNAME="barPackageMismatched.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Package name does not match containing directory</problem_class>
|
||||
<description>Move file to 'bar'</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>barPackageMismatched.kt</file>
|
||||
<line>1</line>
|
||||
<module>testPackageDirectoryMismatch_PackageDirectoryMismatch_0</module>
|
||||
<entry_point TYPE="file" FQNAME="barPackageMismatched.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Package name does not match containing directory</problem_class>
|
||||
<description>Change file's package to 'foo'</description>
|
||||
</problem>
|
||||
</problems>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package
|
||||
|
||||
class Foo
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<caret>package
|
||||
|
||||
class Foo
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"mainFile": "source/test.kt",
|
||||
"intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.MoveFileToPackageMatchingDirectoryIntention",
|
||||
"intentionText": "Move file to source root"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package target
|
||||
|
||||
class Foo
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<caret>package target
|
||||
|
||||
class Foo
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"mainFile": "source/test.kt",
|
||||
"intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.MoveFileToPackageMatchingDirectoryIntention",
|
||||
"intentionText": "Move file to 'target'"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package foo.bar
|
||||
|
||||
class Foo {
|
||||
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
pack<caret>age foo.bar
|
||||
|
||||
class Foo {
|
||||
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.MoveFileToPackageMatchingDirectoryIntention",
|
||||
"isApplicable": "false",
|
||||
"mainFile": "foo/bar/test.kt"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Foo
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
static void test() {
|
||||
new Foo();
|
||||
_DefaultPackage.foo();
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
fun test() {
|
||||
Foo()
|
||||
foo()
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import static _DefaultPackage.foo;
|
||||
|
||||
class Test {
|
||||
static void test() {
|
||||
new Foo();
|
||||
foo();
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import Foo
|
||||
import foo
|
||||
|
||||
fun test() {
|
||||
Foo()
|
||||
foo()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<caret>package source
|
||||
|
||||
class Foo
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
static void test() {
|
||||
new source.Foo();
|
||||
source.SourcePackage.foo();
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
fun test() {
|
||||
source.Foo()
|
||||
source.foo()
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import source.Foo;
|
||||
import static source.SourcePackage.foo;
|
||||
|
||||
class Test {
|
||||
static void test() {
|
||||
new Foo();
|
||||
foo();
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import source.Foo
|
||||
import source.foo
|
||||
|
||||
fun test() {
|
||||
Foo()
|
||||
foo()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"mainFile": "test.kt",
|
||||
"intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageToMatchDirectoryIntention",
|
||||
"intentionText": "Change file's package to ''"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package target
|
||||
|
||||
class Foo
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package target;
|
||||
|
||||
class Test {
|
||||
static void test() {
|
||||
new Foo();
|
||||
TargetPackage.foo();
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package target
|
||||
|
||||
fun test() {
|
||||
Foo()
|
||||
foo()
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package target;
|
||||
|
||||
import static target.TargetPackage.foo;
|
||||
|
||||
class Test {
|
||||
static void test() {
|
||||
new Foo();
|
||||
foo();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package target
|
||||
|
||||
import target.Foo
|
||||
import target.foo
|
||||
|
||||
fun test() {
|
||||
Foo()
|
||||
foo()
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package usages;
|
||||
|
||||
import target.Foo;
|
||||
import target.TargetPackage;
|
||||
|
||||
class Test {
|
||||
static void test() {
|
||||
new Foo();
|
||||
TargetPackage.foo();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package usages
|
||||
|
||||
import target.Foo
|
||||
import target.foo
|
||||
|
||||
fun test() {
|
||||
Foo()
|
||||
foo()
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package usages;
|
||||
|
||||
import target.Foo;
|
||||
import static target.TargetPackage.foo;
|
||||
|
||||
class Test {
|
||||
static void test() {
|
||||
new Foo();
|
||||
foo();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package usages
|
||||
|
||||
import target.Foo
|
||||
import target.foo
|
||||
|
||||
fun test() {
|
||||
Foo()
|
||||
foo()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<caret>package source
|
||||
|
||||
class Foo
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package target;
|
||||
|
||||
class Test {
|
||||
static void test() {
|
||||
new source.Foo();
|
||||
source.SourcePackage.foo();
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package target
|
||||
|
||||
fun test() {
|
||||
source.Foo()
|
||||
source.foo()
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package target;
|
||||
|
||||
import source.Foo;
|
||||
import static source.SourcePackage.foo;
|
||||
|
||||
class Test {
|
||||
static void test() {
|
||||
new Foo();
|
||||
foo();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package target
|
||||
|
||||
import source.Foo
|
||||
import source.foo
|
||||
|
||||
fun test() {
|
||||
Foo()
|
||||
foo()
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package usages;
|
||||
|
||||
class Test {
|
||||
static void test() {
|
||||
new source.Foo();
|
||||
source.SourcePackage.foo();
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package usages
|
||||
|
||||
fun test() {
|
||||
source.Foo()
|
||||
source.foo()
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package usages;
|
||||
|
||||
import source.Foo;
|
||||
import static source.SourcePackage.foo;
|
||||
|
||||
class Test {
|
||||
static void test() {
|
||||
new Foo();
|
||||
foo();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package usages
|
||||
|
||||
import source.Foo
|
||||
import source.foo
|
||||
|
||||
fun test() {
|
||||
Foo()
|
||||
foo()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"mainFile": "target/test.kt",
|
||||
"intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageToMatchDirectoryIntention",
|
||||
"intentionText": "Change file's package to 'target'"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package foo.bar
|
||||
|
||||
class Foo {
|
||||
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
pack<caret>age foo.bar
|
||||
|
||||
class Foo {
|
||||
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageToMatchDirectoryIntention",
|
||||
"isApplicable": "false",
|
||||
"mainFile": "foo/bar/test.kt"
|
||||
}
|
||||
Reference in New Issue
Block a user