KT-44079 [Sealed Interfaces]: move refactoring update
The idea behind this commit is that Move Refactoring should warn developers in case their intention potentially breaks sealed hierarchies (members must share the same module and package). Provided algorithm has two goals: - prevent destruction of correct hierarchies - help in fixing broken ones
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="B" />
|
||||
</component>
|
||||
</module>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package sealed
|
||||
|
||||
sealed interface SealedInterfaceB
|
||||
|
||||
class HierarchyClassA: SealedInterfaceA, SealedInterfaceB
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package sealed
|
||||
|
||||
interface HelloGitEmptyDir
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package sealed
|
||||
|
||||
sealed interface SealedInterfaceA
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="B" />
|
||||
</component>
|
||||
</module>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package sealed
|
||||
|
||||
sealed interface <caret>SealedInterfaceA
|
||||
sealed interface SealedInterfaceB
|
||||
|
||||
class HierarchyClassA: SealedInterfaceA, SealedInterfaceB
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package sealed
|
||||
|
||||
interface HelloGitEmptyDir
|
||||
+1
@@ -0,0 +1 @@
|
||||
Sealed hierarchy of 'SealedInterfaceA' would be split. None of its members reside in the package 'sealed' of module 'B': [sealed.SealedInterfaceA, sealed.HierarchyClassA, sealed.SealedInterfaceB].
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"mainFile": "A/src/sealed/SealedHierarchy.kt",
|
||||
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
|
||||
"targetPackage": "sealed",
|
||||
"targetSourceRoot": "B/src",
|
||||
"withRuntime": "false"
|
||||
}
|
||||
Reference in New Issue
Block a user