asPsiTypeParameters¶
context(session: KaSession)
fun KaTypeParameterSymbol.asPsiTypeParameters(): List<PsiTypeParameter>
Converts the given KaTypeParameterSymbol to Java PsiTypeParameters in the context of the useSiteModule.
The resulting list is the view on the given Kotlin type parameter from Java and contains all PsiTypeParameters produced by this. Multiple type parameters might be produced when the enclosing Kotlin declaration is mapped to multiple Java PSI declarations.
useSiteModule for the current KaSession is used to provide proper actualizations for expect declarations. Since the produced list is a JVM-specific representation, useSiteModule is expected to be a JVM one.
If useSiteModule is not a JVM module or the provided KaTypeParameterSymbol is not visible from Java, returns an empty list.
Example:¶
The following Kotlin type parameter T:
Is seen as the following PsiTypeParameters from Java:
public final class MyFileKt {
@kotlin.jvm.JvmName(name = "jvmFoo")
@kotlin.jvm.JvmOverloads()
public static final <T> void jvmFoo(T a);
// ^^^
// PsiTypeParameter
@kotlin.jvm.JvmName(name = "jvmFoo")
@kotlin.jvm.JvmOverloads()
public static final <T> void jvmFoo(T a, int b);
// ^^^
// PsiTypeParameter
}