KotlinElementActionsFactory: adding empty annotations without parenthesises

This commit is contained in:
Nicolay Mitropolsky
2019-03-19 15:36:32 +03:00
committed by Nicolay Mitropolsky
parent 1669b6aa9f
commit af63fcb3be
2 changed files with 4 additions and 4 deletions
@@ -479,12 +479,12 @@ internal fun addAnnotationEntry(
KtPsiFactory(target) KtPsiFactory(target)
.createAnnotationEntry( .createAnnotationEntry(
"@$annotationUseSiteTargetPrefix${request.qualifiedName}${ "@$annotationUseSiteTargetPrefix${request.qualifiedName}${
request.attributes.mapIndexed { i, p -> request.attributes.takeIf { it.isNotEmpty() }?.mapIndexed { i, p ->
if (!kotlinAnnotation && i == 0 && p.name == "value") if (!kotlinAnnotation && i == 0 && p.name == "value")
renderAttributeValue(p.value).toString() renderAttributeValue(p.value).toString()
else else
"${p.name} = ${renderAttributeValue(p.value)}" "${p.name} = ${renderAttributeValue(p.value)}"
}.joinToString(", ", "(", ")") }?.joinToString(", ", "(", ")") ?: ""
}" }"
) )
) )
@@ -272,7 +272,7 @@ class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() {
import pkg.myannotation.JavaAnnotation import pkg.myannotation.JavaAnnotation
class Foo { class Foo {
@field:JavaAnnotation() @field:JavaAnnotation
val bar: String = null val bar: String = null
} }
""".trimIndent(), true """.trimIndent(), true
@@ -324,7 +324,7 @@ class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() {
import pkg.myannotation.JavaAnnotation import pkg.myannotation.JavaAnnotation
class Foo { class Foo {
@JavaAnnotation() @JavaAnnotation
val bar: String = null val bar: String = null
} }
""".trimIndent(), true """.trimIndent(), true