Extract Superclass/Interface/Pull Up: Reformat modifier lists of generated declarations (to add spaces where needed)
#KT-15639 Fixed
This commit is contained in:
@@ -480,6 +480,7 @@ These artifacts include extensions for the types available in the latter JDKs, s
|
||||
- [`KT-15643`](https://youtrack.jetbrains.com/issue/KT-15643) Extract Interface/Pull Up: Disable "Make abstract" and assume it to be true for primary constructor parameter when moving to an interface
|
||||
- [`KT-15607`](https://youtrack.jetbrains.com/issue/KT-15607) Extract Interface/Pull Up: Disable internal/protected members when moving to an interface
|
||||
- [`KT-15640`](https://youtrack.jetbrains.com/issue/KT-15640) Extract Interface/Pull Up: Drop 'final' modifier when moving to an interface
|
||||
- [`KT-15639`](https://youtrack.jetbrains.com/issue/KT-15639) Extract Superclass/Interface/Pull Up: Add spaces between 'abstract' modifier and annotations
|
||||
|
||||
#### Intention actions, inspections and quickfixes
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.idea.refactoring.pullUp
|
||||
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager
|
||||
import com.intellij.psi.impl.light.LightField
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
@@ -533,6 +534,8 @@ class KotlinPullUpHelper(
|
||||
else -> return
|
||||
}
|
||||
|
||||
movedMember.modifierList?.let { CodeStyleManager.getInstance(member.manager).reformat(it) }
|
||||
|
||||
applyMarking(movedMember, data.sourceToTargetClassSubstitutor, data.targetClassDescriptor)
|
||||
addMovedMember(movedMember)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// NAME: A
|
||||
annotation class Concat
|
||||
|
||||
// SIBLING:
|
||||
class <caret>Abstraction {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
@Concat var extraction = 0
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// NAME: A
|
||||
annotation class Concat
|
||||
|
||||
abstract class A {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
@Concat abstract var extraction: Int
|
||||
}
|
||||
|
||||
// SIBLING:
|
||||
class Abstraction : A() {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
@Concat override var extraction = 0
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
annotation class Concat
|
||||
|
||||
open class A
|
||||
|
||||
class <caret>Abstraction : A() {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
@Concat var extraction = 0
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
annotation class Concat
|
||||
|
||||
abstract class A {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
@Concat abstract var extraction: Int
|
||||
}
|
||||
|
||||
class Abstraction : A() {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
@Concat override var extraction = 0
|
||||
}
|
||||
+6
@@ -4307,6 +4307,12 @@ public class ExtractionTestGenerated extends AbstractExtractionTest {
|
||||
doExtractSuperclassTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reformatModifierList.kt")
|
||||
public void testReformatModifierList() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/extractSuperclass/reformatModifierList.kt");
|
||||
doExtractSuperclassTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("replaceSuperclass.kt")
|
||||
public void testReplaceSuperclass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/extractSuperclass/replaceSuperclass.kt");
|
||||
|
||||
@@ -314,6 +314,12 @@ public class PullUpTestGenerated extends AbstractPullUpTest {
|
||||
doKotlinTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reformatModifierList.kt")
|
||||
public void testReformatModifierList() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/pullUp/k2k/reformatModifierList.kt");
|
||||
doKotlinTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("removeVisibilityOnOverride.kt")
|
||||
public void testRemoveVisibilityOnOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/pullUp/k2k/removeVisibilityOnOverride.kt");
|
||||
|
||||
Reference in New Issue
Block a user