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 dbf09308628..cc829854788 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 @@ internal fun addAnnotationEntry( 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 0f1c907871f..4d16b012287 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 @@ class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() { import pkg.myannotation.JavaAnnotation class Foo { - @field:JavaAnnotation() + @field:JavaAnnotation val bar: String = null } """.trimIndent(), true @@ -324,7 +324,7 @@ class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() { import pkg.myannotation.JavaAnnotation class Foo { - @JavaAnnotation() + @JavaAnnotation val bar: String = null } """.trimIndent(), true