createType
fun KClassifier.createType(arguments: List<KTypeProjection> = emptyList(), nullable: Boolean = false, annotations: List<Annotation> = emptyList()): KType(source)
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.