182: KotlinElementActionsFactory: "value"-parameters in generated java-annotations is putted without explicit parameter name #KT-23644
This commit is contained in:
+10
-3
@@ -436,13 +436,20 @@ class KotlinElementActionsFactory : JvmElementActionsFactory() {
|
||||
|
||||
override fun invoke(project: Project, editor: Editor?, file: PsiFile?) {
|
||||
val target = pointer.element ?: return
|
||||
val kotlinAnnotation = JavaPsiFacade.getInstance(project).findClass(
|
||||
request.qualifiedName,
|
||||
target.resolveScope
|
||||
)?.language == KotlinLanguage.INSTANCE
|
||||
val entry = target.addAnnotationEntry(
|
||||
KtPsiFactory(target)
|
||||
.createAnnotationEntry(
|
||||
"@${request.qualifiedName}${
|
||||
request.attributes.joinToString(", ", "(", ")") { p ->
|
||||
"${p.name} = ${renderAttributeValue(p.value)}"
|
||||
}
|
||||
request.attributes.mapIndexed { i, p ->
|
||||
if (!kotlinAnnotation && i == 0 && p.name == "value")
|
||||
renderAttributeValue(p.value).toString()
|
||||
else
|
||||
"${p.name} = ${renderAttributeValue(p.value)}"
|
||||
}.joinToString(", ", "(", ")")
|
||||
}"
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user