[kotlin] PsiClassRenderer: render type parameter annotations

^KT-65112

GitOrigin-RevId: fbe9842fdbb05292650cef5c959d33f6a08eafae
This commit is contained in:
Dmitrii Gridin
2024-02-14 17:12:06 +01:00
committed by intellij-monorepo-bot
parent 4d3b724bca
commit 831dc4ef61

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.asJava
@@ -143,11 +143,14 @@ class PsiClassRenderer private constructor(
private fun Array<PsiTypeParameter>.renderTypeParams() =
if (isEmpty()) ""
else "<" + joinToString {
val bounds =
if (it.extendsListTypes.isNotEmpty())
" extends " + it.extendsListTypes.joinToString(" & ", transform = { it.renderType() })
else ""
it.name!! + bounds
val extendsListTypes = it.extendsListTypes
val bounds = if (extendsListTypes.isNotEmpty()) {
" extends " + extendsListTypes.joinToString(" & ", transform = { it.renderType() })
} else {
""
}
it.renderModifiers() + it.name!! + bounds
} + "> "
private fun KtLightPsiLiteral.renderKtLightPsiLiteral(): String {
@@ -291,7 +294,7 @@ class PsiClassRenderer private constructor(
val renderedAnnotation = annotation.renderAnnotation()
if (renderedAnnotation.isNotEmpty()) {
annotationsBuffer.add(
renderedAnnotation + (if (this is PsiParameter) " " else "\n")
renderedAnnotation + (if (this is PsiParameter || this is PsiTypeParameter) " " else "\n")
)
}
}