KotlinElementActionsFactory: adding empty annotations without parenthesises
diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/crossLanguage/KotlinElementActionsFactory.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/crossLanguage/KotlinElementActionsFactory.kt index dbf0930..cc82985 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/crossLanguage/KotlinElementActionsFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/crossLanguage/KotlinElementActionsFactory.kt
@@ -479,12 +479,12 @@ KtPsiFactory(target) .createAnnotationEntry( "@$annotationUseSiteTargetPrefix${request.qualifiedName}${ - request.attributes.mapIndexed { i, p -> + request.attributes.takeIf { it.isNotEmpty() }?.mapIndexed { i, p -> if (!kotlinAnnotation && i == 0 && p.name == "value") renderAttributeValue(p.value).toString() else "${p.name} = ${renderAttributeValue(p.value)}" - }.joinToString(", ", "(", ")") + }?.joinToString(", ", "(", ")") ?: "" }" ) )
diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt b/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt index 0f1c907..4d16b01 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt
@@ -272,7 +272,7 @@ import pkg.myannotation.JavaAnnotation class Foo { - @field:JavaAnnotation() + @field:JavaAnnotation val bar: String = null } """.trimIndent(), true @@ -324,7 +324,7 @@ import pkg.myannotation.JavaAnnotation class Foo { - @JavaAnnotation() + @JavaAnnotation val bar: String = null } """.trimIndent(), true