MoveKotlinDeclarationsProcessor: fix formatting for long qualifier names
#KT-35338 Fixed
This commit is contained in:
+3
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -37,6 +37,7 @@ import org.jetbrains.kotlin.asJava.namedUnwrappedElement
|
|||||||
import org.jetbrains.kotlin.asJava.toLightElements
|
import org.jetbrains.kotlin.asJava.toLightElements
|
||||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.shorten.addToBeShortenedDescendantsToWaitingSet
|
import org.jetbrains.kotlin.idea.codeInsight.shorten.addToBeShortenedDescendantsToWaitingSet
|
||||||
|
import org.jetbrains.kotlin.idea.codeInsight.shorten.performDelayedRefactoringRequests
|
||||||
import org.jetbrains.kotlin.idea.core.deleteSingle
|
import org.jetbrains.kotlin.idea.core.deleteSingle
|
||||||
import org.jetbrains.kotlin.idea.core.quoteIfNeeded
|
import org.jetbrains.kotlin.idea.core.quoteIfNeeded
|
||||||
import org.jetbrains.kotlin.idea.refactoring.broadcastRefactoringExit
|
import org.jetbrains.kotlin.idea.refactoring.broadcastRefactoringExit
|
||||||
@@ -376,8 +377,8 @@ class MoveKotlinDeclarationsProcessor(
|
|||||||
internalUsageScopes.forEach { newInternalUsages += restoreInternalUsages(it, oldToNewElementsMapping) }
|
internalUsageScopes.forEach { newInternalUsages += restoreInternalUsages(it, oldToNewElementsMapping) }
|
||||||
|
|
||||||
usagesToProcess += newInternalUsages
|
usagesToProcess += newInternalUsages
|
||||||
|
|
||||||
nonCodeUsages = postProcessMoveUsages(usagesToProcess, oldToNewElementsMapping).toTypedArray()
|
nonCodeUsages = postProcessMoveUsages(usagesToProcess, oldToNewElementsMapping).toTypedArray()
|
||||||
|
performDelayedRefactoringRequests(project)
|
||||||
} catch (e: IncorrectOperationException) {
|
} catch (e: IncorrectOperationException) {
|
||||||
nonCodeUsages = null
|
nonCodeUsages = null
|
||||||
RefactoringUIUtil.processIncorrectOperation(myProject, e)
|
RefactoringUIUtil.processIncorrectOperation(myProject, e)
|
||||||
|
|||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package org.xxxxxx.yyyyyy.zzzzzz.ttttt
|
||||||
|
|
||||||
|
class SomeVeryImportantClass {
|
||||||
|
fun getSomeData(): Any? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getInstance(o: Any): SomeVeryImportantClass = SomeVeryImportantClass()
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
|
||||||
|
|
||||||
|
class SomeVeryImportantClass {
|
||||||
|
fun getSomeData(): Any? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getInstance(o: Any): SomeVeryImportantClass = SomeVeryImportantClass()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"mainFile": "com/xxxxxxx/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz/Y.kt",
|
||||||
|
"type": "CHANGE_PACKAGE_DIRECTIVE",
|
||||||
|
"newPackageName": "org.xxxxxx.yyyyyy.zzzzzz.ttttt"
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
|
||||||
|
|
||||||
|
class SomeVeryImportantClass {
|
||||||
|
fun getSomeData(): Any? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getInstance(o: Any): SomeVeryImportantClass = SomeVeryImportantClass()
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package org.xxxxxx.yyyyyy.zzzzzz.ttttt
|
||||||
|
|
||||||
|
import com.xxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.SomeVeryImportantClass
|
||||||
|
|
||||||
|
class X {
|
||||||
|
fun foo(parameter: Any) {
|
||||||
|
val data = SomeVeryImportantClass.getInstance(parameter).getSomeData()
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package com.xxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
|
||||||
|
|
||||||
|
class X {
|
||||||
|
fun foo(parameter: Any) {
|
||||||
|
val data = SomeVeryImportantClass.getInstance(parameter).getSomeData()
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
|
||||||
|
|
||||||
|
class SomeVeryImportantClass {
|
||||||
|
fun getSomeData(): Any? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getInstance(o: Any): SomeVeryImportantClass = SomeVeryImportantClass()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"mainFile": "com/xxxxxxx/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz/X.kt",
|
||||||
|
"type": "MOVE_FILES",
|
||||||
|
"targetPackage": "org.xxxxxx.yyyyyy.zzzzzz.ttttt"
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
package com.xxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
|
||||||
|
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
|
||||||
|
|
||||||
|
class SomeVeryImportantClass {
|
||||||
|
fun getSomeData(): Any? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getInstance(o: Any): SomeVeryImportantClass = SomeVeryImportantClass()
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package org.xxxxxx.yyyyyy.zzzzzz.ttttt
|
||||||
|
|
||||||
|
import com.xxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.SomeVeryImportantClass
|
||||||
|
|
||||||
|
class X {
|
||||||
|
fun foo(parameter: Any) {
|
||||||
|
val data = SomeVeryImportantClass.getInstance(parameter).getSomeData()
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package com.xxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
|
||||||
|
|
||||||
|
class <caret>X {
|
||||||
|
fun foo(parameter: Any) {
|
||||||
|
val data = SomeVeryImportantClass.getInstance(parameter).getSomeData()
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
|
||||||
|
|
||||||
|
class SomeVeryImportantClass {
|
||||||
|
fun getSomeData(): Any? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getInstance(o: Any): SomeVeryImportantClass = SomeVeryImportantClass()
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"mainFile": "com/xxxxxxx/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz/X.kt",
|
||||||
|
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
|
||||||
|
"targetPackage": "org.xxxxxx.yyyyyy.zzzzzz.ttttt"
|
||||||
|
}
|
||||||
+15
@@ -223,6 +223,11 @@ public class MoveTestGenerated extends AbstractMoveTest {
|
|||||||
runTest("idea/testData/refactoring/move/kotlin/changePackage/headerClasses/headerClasses.test");
|
runTest("idea/testData/refactoring/move/kotlin/changePackage/headerClasses/headerClasses.test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlin/changePackage/longName/longName.test")
|
||||||
|
public void testKotlin_changePackage_longName_LongName() throws Exception {
|
||||||
|
runTest("idea/testData/refactoring/move/kotlin/changePackage/longName/longName.test");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kotlin/moveDirectory/moveDirectoryWithPackageDirectiveChange/moveDirectoryWithPackageDirectiveChange.test")
|
@TestMetadata("kotlin/moveDirectory/moveDirectoryWithPackageDirectiveChange/moveDirectoryWithPackageDirectiveChange.test")
|
||||||
public void testKotlin_moveDirectory_moveDirectoryWithPackageDirectiveChange_MoveDirectoryWithPackageDirectiveChange() throws Exception {
|
public void testKotlin_moveDirectory_moveDirectoryWithPackageDirectiveChange_MoveDirectoryWithPackageDirectiveChange() throws Exception {
|
||||||
runTest("idea/testData/refactoring/move/kotlin/moveDirectory/moveDirectoryWithPackageDirectiveChange/moveDirectoryWithPackageDirectiveChange.test");
|
runTest("idea/testData/refactoring/move/kotlin/moveDirectory/moveDirectoryWithPackageDirectiveChange/moveDirectoryWithPackageDirectiveChange.test");
|
||||||
@@ -253,6 +258,11 @@ public class MoveTestGenerated extends AbstractMoveTest {
|
|||||||
runTest("idea/testData/refactoring/move/kotlin/moveFile/keepImportAliasRefs/keepImportAliasRefs.test");
|
runTest("idea/testData/refactoring/move/kotlin/moveFile/keepImportAliasRefs/keepImportAliasRefs.test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlin/moveFile/longName/longName.test")
|
||||||
|
public void testKotlin_moveFile_longName_LongName() throws Exception {
|
||||||
|
runTest("idea/testData/refactoring/move/kotlin/moveFile/longName/longName.test");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kotlin/moveFile/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir.test")
|
@TestMetadata("kotlin/moveFile/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir.test")
|
||||||
public void testKotlin_moveFile_moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir_MoveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir() throws Exception {
|
public void testKotlin_moveFile_moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir_MoveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir() throws Exception {
|
||||||
runTest("idea/testData/refactoring/move/kotlin/moveFile/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir.test");
|
runTest("idea/testData/refactoring/move/kotlin/moveFile/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir.test");
|
||||||
@@ -678,6 +688,11 @@ public class MoveTestGenerated extends AbstractMoveTest {
|
|||||||
runTest("idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackage/moveClassToPackage.test");
|
runTest("idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToPackage/moveClassToPackage.test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlin/moveTopLevelDeclarations/moveClassWithLongFunction/moveClassWithLongFunction.test")
|
||||||
|
public void testKotlin_moveTopLevelDeclarations_moveClassWithLongFunction_MoveClassWithLongFunction() throws Exception {
|
||||||
|
runTest("idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassWithLongFunction/moveClassWithLongFunction.test");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kotlin/moveTopLevelDeclarations/moveExtensionFunctionToFil/moveExtensionFunctionToFile.test")
|
@TestMetadata("kotlin/moveTopLevelDeclarations/moveExtensionFunctionToFil/moveExtensionFunctionToFile.test")
|
||||||
public void testKotlin_moveTopLevelDeclarations_moveExtensionFunctionToFil_MoveExtensionFunctionToFile() throws Exception {
|
public void testKotlin_moveTopLevelDeclarations_moveExtensionFunctionToFil_MoveExtensionFunctionToFile() throws Exception {
|
||||||
runTest("idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveExtensionFunctionToFil/moveExtensionFunctionToFile.test");
|
runTest("idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveExtensionFunctionToFil/moveExtensionFunctionToFile.test");
|
||||||
|
|||||||
Reference in New Issue
Block a user