Intention action for hiddnen declarations fixed

This commit is contained in:
Andrey Breslav
2015-10-09 14:50:45 +03:00
parent 1c00b933a5
commit 4f63d47f82
3 changed files with 5 additions and 7 deletions
@@ -223,14 +223,13 @@ public class ConflictingExtensionPropertyInspection : AbstractKotlinInspection()
}
private class MarkHiddenAndDeprecatedAction(property: JetProperty) : JetIntentionAction<JetProperty>(property) {
override fun getFamilyName() = "Mark with @HiddenDeclaration and @Deprecated"
override fun getFamilyName() = "Mark as @Deprecated(..., level = DeprecationLevel.HIDDEN)"
override fun getText() = familyName
override fun invoke(project: Project, editor: Editor?, file: JetFile) {
val factory = JetPsiFactory(project)
val name = element.nameAsName!!.render()
element.addAnnotationWithLineBreak(factory.createAnnotationEntry("@Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"$name\"))"))
element.addAnnotationWithLineBreak(factory.createAnnotationEntry("@HiddenDeclaration"))
element.addAnnotationWithLineBreak(factory.createAnnotationEntry("@Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"$name\"), level = DeprecationLevel.HIDDEN)"))
}
//TODO: move into PSI?
@@ -1,4 +1,4 @@
// "Mark with @HiddenDeclaration and @Deprecated" "true"
// "Mark as @Deprecated(..., level = DeprecationLevel.HIDDEN)" "true"
import java.io.File
val File.<caret>name: String
@@ -1,7 +1,6 @@
// "Mark with @HiddenDeclaration and @Deprecated" "true"
// "Mark as @Deprecated(..., level = DeprecationLevel.HIDDEN)" "true"
import java.io.File
@HiddenDeclaration
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("name"))
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("name"), level = DeprecationLevel.HIDDEN)
val File.<caret>name: String
get() = getName()