W3cubDocs

/Kotlin

createType

Platform and version requirements: JVM (1.1)
fun KClassifier.createType(
    arguments: List<KTypeProjection> = emptyList(), 
    nullable: Boolean = false, 
    annotations: List<Annotation> = emptyList()
): KType

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.

For classifiers representing type parameters, the type argument list must always be empty. For classes, the type argument list should contain arguments for the type parameters of the class. If the class is inner, the list should follow with arguments for the type parameters of its outer class, and so forth until a class is not inner, or is declared on the top level.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect.full/create-type.html