KTypeParameter

JVM
JS
1.1
interface KTypeParameter : KClassifier

Represents a declaration of a type parameter of a class or a callable. See the Kotlin language documentation for more information.

Properties

JVM
JS
1.0

isReified

true if this type parameter is reified. See the Kotlin language documentation for more information.

abstract val isReified: Boolean
JVM
JS
1.0

name

The name of this type parameter as it was declared in the source code.

abstract val name: String
JVM
JS
1.0

upperBounds

Upper bounds, or generic constraints imposed on this type parameter. See the Kotlin language documentation for more information.

abstract val upperBounds: List<KType>
JVM
JS
1.0

variance

Declaration-site variance of this type parameter. See the Kotlin language documentation for more information.

abstract val variance: KVariance

Extension Properties

JVM
1.1

starProjectedType

Creates an instance of KType with the given classifier, substituting all its type parameters with star projections. The resulting type is not marked as nullable and does not have any annotations.

val KClassifier.starProjectedType: KType

Extension Functions

JVM
1.1

createType

Creates a KType instance with the given classifier, type arguments, nullability and annotations. If the number of passed type arguments is not equal to the total number of type parameters of a classifier, an exception is thrown. If any of the arguments does not satisfy the bounds of the corresponding type parameter, an exception is thrown.

fun KClassifier.createType(
    arguments: List<KTypeProjection> = emptyList(),
    nullable: Boolean = false,
    annotations: List<Annotation> = emptyList()
): KType