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>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package sealed
|
||||
|
||||
sealed 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
|
||||
|
||||
sealed interface SealedInterfaceA
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package sealed
|
||||
|
||||
sealed interface SealedInterfaceB
|
||||
+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>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package sealed
|
||||
|
||||
sealed interface <caret>SealedInterfaceA
|
||||
sealed 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
|
||||
|
||||
sealed interface SealedInterfaceB
|
||||
+1
@@ -0,0 +1 @@
|
||||
Sealed hierarchy of 'SealedInterfaceA' would be split. Package 'sealed' of module 'A' would still contain its members: [sealed.HierarchyClassA].
|
||||
+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