diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/JetBundle.properties b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/JetBundle.properties index 6297fbb0417..c61565b4fc1 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/JetBundle.properties +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/JetBundle.properties @@ -180,10 +180,10 @@ options.kotlin.attribute.descriptor.smart.cast=Smart-cast value options.kotlin.attribute.descriptor.label=Label change.to.function.invocation=Change to function invocation migrate.sure=Replace sure() calls by !! in project -migrate.class.object.to.default=Replace 'class' keyword with 'default' modifier -migrate.class.object.to.default.family=Replace 'class' Keyword with 'default' Modifier -migrate.class.object.to.default.in.whole.project=Replace 'class' keyword with 'default' modifier in whole project -migrate.class.object.to.default.in.whole.project.family=Replace 'class' Keyword with 'default' Modifier in Whole Project +migrate.class.object.to.companion=Replace 'class' keyword with 'companion' modifier +migrate.class.object.to.companion.family=Replace 'class' Keyword with 'companion' Modifier +migrate.class.object.to.companion.in.whole.project=Replace 'class' keyword with 'companion' modifier in whole project +migrate.class.object.to.companion.in.whole.project.family=Replace 'class' Keyword with 'companion' Modifier in Whole Project remove.val.var.from.parameter=Remove ''{0}'' from parameter add.override.to.equals.hashCode.toString=Add 'override' to equals, hashCode, toString in project add.when.else.branch.action.family.name=Add Else Branch diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ClassObjectToDefaultObjectFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/ClassObjectToDefaultObjectFix.kt index eb52f415199..edacc90d49e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ClassObjectToDefaultObjectFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ClassObjectToDefaultObjectFix.kt @@ -25,19 +25,19 @@ import org.jetbrains.kotlin.lexer.JetTokens import org.jetbrains.kotlin.psi.* public class ClassObjectToCompanionObjectFix(private val elem: JetObjectDeclaration) : JetIntentionAction(elem) { - override fun getText(): String = JetBundle.message("migrate.class.object.to.default") + override fun getText(): String = JetBundle.message("migrate.class.object.to.companion") - override fun getFamilyName(): String = JetBundle.message("migrate.class.object.to.default.family") + override fun getFamilyName(): String = JetBundle.message("migrate.class.object.to.companion.family") override fun invoke(project: Project, editor: Editor, file: JetFile) { - classKeywordToDefaultModifier(elem) + classKeywordToCompanionModifier(elem) } class object Factory : JetSingleIntentionActionFactory() { override fun createAction(diagnostic: Diagnostic) = (diagnostic.getPsiElement() as? JetObjectDeclaration)?.let { ClassObjectToCompanionObjectFix(it) } - fun classKeywordToDefaultModifier(objectDeclaration: JetObjectDeclaration) { + fun classKeywordToCompanionModifier(objectDeclaration: JetObjectDeclaration) { objectDeclaration.getClassKeyword()?.delete() if (!objectDeclaration.hasModifier(JetTokens.COMPANION_KEYWORD)) { objectDeclaration.addModifier(JetTokens.COMPANION_KEYWORD) @@ -47,9 +47,9 @@ public class ClassObjectToCompanionObjectFix(private val elem: JetObjectDeclarat } public class ClassObjectToCompanionObjectInWholeProjectFix(private val elem: JetObjectDeclaration) : JetIntentionAction(elem) { - override fun getText(): String = JetBundle.message("migrate.class.object.to.default.in.whole.project") + override fun getText(): String = JetBundle.message("migrate.class.object.to.companion.in.whole.project") - override fun getFamilyName(): String = JetBundle.message("migrate.class.object.to.default.in.whole.project.family") + override fun getFamilyName(): String = JetBundle.message("migrate.class.object.to.companion.in.whole.project.family") override fun invoke(project: Project, editor: Editor, file: JetFile) { val files = PluginJetFilesProvider.allFilesInProject(file.getProject()) @@ -61,7 +61,7 @@ public class ClassObjectToCompanionObjectInWholeProjectFix(private val elem: Jet override fun visitObjectDeclaration(objectDeclaration: JetObjectDeclaration) { objectDeclaration.acceptChildren(this) if (objectDeclaration.getClassKeyword() != null) { - ClassObjectToCompanionObjectFix.classKeywordToDefaultModifier(objectDeclaration) + ClassObjectToCompanionObjectFix.classKeywordToCompanionModifier(objectDeclaration) } } } diff --git a/idea/testData/quickfix/migration/afterClassObjectToDefaultSingle.kt b/idea/testData/quickfix/migration/afterClassObjectToDefaultSingle.kt index 1fcf30dab28..bdc24102abf 100644 --- a/idea/testData/quickfix/migration/afterClassObjectToDefaultSingle.kt +++ b/idea/testData/quickfix/migration/afterClassObjectToDefaultSingle.kt @@ -1,4 +1,4 @@ -// "Replace 'class' keyword with 'default' modifier" "true" +// "Replace 'class' keyword with 'companion' modifier" "true" class A { public companion object { diff --git a/idea/testData/quickfix/migration/beforeClassObjectToDefaultSingle.kt b/idea/testData/quickfix/migration/beforeClassObjectToDefaultSingle.kt index 9a001aebec3..701d6265adc 100644 --- a/idea/testData/quickfix/migration/beforeClassObjectToDefaultSingle.kt +++ b/idea/testData/quickfix/migration/beforeClassObjectToDefaultSingle.kt @@ -1,4 +1,4 @@ -// "Replace 'class' keyword with 'default' modifier" "true" +// "Replace 'class' keyword with 'companion' modifier" "true" class A { public class object { diff --git a/idea/testData/quickfix/migration/classObjectToDefaultMultiple.after.kt b/idea/testData/quickfix/migration/classObjectToDefaultMultiple.after.kt index 339254fd946..5a3ce4fbeae 100644 --- a/idea/testData/quickfix/migration/classObjectToDefaultMultiple.after.kt +++ b/idea/testData/quickfix/migration/classObjectToDefaultMultiple.after.kt @@ -1,4 +1,4 @@ -// "Replace 'class' keyword with 'default' modifier in whole project" "true" +// "Replace 'class' keyword with 'companion' modifier in whole project" "true" class A { public companion object { diff --git a/idea/testData/quickfix/migration/classObjectToDefaultMultiple.before.Main.kt b/idea/testData/quickfix/migration/classObjectToDefaultMultiple.before.Main.kt index 8549616ebc9..e5454b16a70 100644 --- a/idea/testData/quickfix/migration/classObjectToDefaultMultiple.before.Main.kt +++ b/idea/testData/quickfix/migration/classObjectToDefaultMultiple.before.Main.kt @@ -1,4 +1,4 @@ -// "Replace 'class' keyword with 'default' modifier in whole project" "true" +// "Replace 'class' keyword with 'companion' modifier in whole project" "true" class A { public class object {