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:
Vendored
+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 sealedFirst
|
||||
|
||||
sealed interface SealedInterfaceA
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package sealedSecond
|
||||
|
||||
import sealedFirst.SealedInterfaceA
|
||||
|
||||
sealed class HierarchyClassA: SealedInterfaceA, SealedInterfaceB
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package sealedSecond
|
||||
|
||||
sealed interface SealedInterfaceB
|
||||
Vendored
+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>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package sealedFirst
|
||||
|
||||
import sealedSecond.SealedInterfaceB
|
||||
|
||||
sealed interface SealedInterfaceA
|
||||
sealed class <caret>HierarchyClassA: SealedInterfaceA, SealedInterfaceB
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package sealedSecond
|
||||
|
||||
sealed interface SealedInterfaceB
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
Sealed hierarchy of 'HierarchyClassA' would be split. Package 'sealedFirst' of module 'A' would still contain its members: [sealedFirst.SealedInterfaceA].
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"mainFile": "A/src/sealedFirst/SealedHierarchyPartA.kt",
|
||||
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
|
||||
"targetPackage": "sealedSecond",
|
||||
"targetSourceRoot": "A/src",
|
||||
"withRuntime": "false"
|
||||
}
|
||||
Reference in New Issue
Block a user