[LC] PsiClassRenderer: render type parameter annotations
^KT-65112
This commit is contained in:
committed by
Space Team
parent
3e3c932bf6
commit
717dd08fd4
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
public final class C /* one.C*/<@one.Anno() T> {
|
||||
public C();// .ctor()
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
public abstract interface C /* one.C*/<@one.Anno() T> {
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
public final class C /* one.C*/ {
|
||||
public C();// .ctor()
|
||||
|
||||
public final <@one.Anno() T> void foo(T);// <@one.Anno() T> foo(T)
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
public final class C /* one.C*/ {
|
||||
public C();// .ctor()
|
||||
|
||||
public final <T> int getFoo(T);// <T> getFoo(T)
|
||||
public final <@one.Anno() T> int getFoo(T);// <@one.Anno() T> getFoo(T)
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public final class FunctionTypeParameterAnnotationKt /* one.FunctionTypeParameterAnnotationKt*/ {
|
||||
public static final <@one.Anno() T> void foo(T);// <@one.Anno() T> foo(T)
|
||||
}
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
public final class PropertyTypeParameterAnnotationKt /* one.PropertyTypeParameterAnnotationKt*/ {
|
||||
public static final <T> int getFoo(T);// <T> getFoo(T)
|
||||
public static final <@one.Anno() T> int getFoo(T);// <@one.Anno() T> getFoo(T)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -146,11 +146,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 {
|
||||
@@ -294,7 +297,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")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user