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:
Andrei Klunnyi
2021-01-22 14:41:19 +01:00
committed by Space
parent de3678a805
commit 690fb47cbb
116 changed files with 847 additions and 132 deletions
@@ -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>
@@ -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>
@@ -0,0 +1,4 @@
package sealed
sealed interface SealedInterfaceA
sealed class HierarchyClassA: SealedInterfaceA, SealedInterfaceB
@@ -0,0 +1,3 @@
package sealed
sealed interface SealedInterfaceB
@@ -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>
@@ -0,0 +1,4 @@
package sealed
sealed interface <caret>SealedInterfaceA
sealed class <caret>HierarchyClassA: SealedInterfaceA, SealedInterfaceB
@@ -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>
@@ -0,0 +1,3 @@
package sealed
sealed interface SealedInterfaceB
@@ -0,0 +1,7 @@
{
"mainFile": "A/src/sealed/SealedHierarchy.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "sealed",
"targetSourceRoot": "B/src",
"withRuntime": "false"
}