KType

expect interface KType(source)

Represents a type. Type is usually either a class with optional type arguments, or a type parameter of some declaration, plus nullability.

Since Kotlin

1.2
actual interface KType : KAnnotatedElement(source)

Represents a type. Type is usually either a class with optional type arguments, or a type parameter of some declaration, plus nullability.

Since Kotlin

1.0
actual interface KType(source)

Represents a type. Type is usually either a class with optional type arguments, or a type parameter of some declaration, plus nullability.

Since Kotlin

1.1
actual interface KType(source)

Represents a type. Type is usually either a class with optional type arguments, or a type parameter of some declaration, plus nullability.

Since Kotlin

1.3

Properties

Link copied to clipboard
abstract val annotations: List<Annotation>

Annotations which are present on this element.

Since Kotlin 1.0
Link copied to clipboard
expect abstract val arguments: List<KTypeProjection>

Type arguments passed for the parameters of the classifier in this type. For example, in the type Array<out Number> the only type argument is out Number.

Since Kotlin 1.2
actual abstract val arguments: List<KTypeProjection>

Type arguments passed for the parameters of the classifier in this type. For example, in the type Array<out Number> the only type argument is out Number.

Since Kotlin 1.1
actual abstract val arguments: List<KTypeProjection>

Type arguments passed for the parameters of the classifier in this type. For example, in the type Array<out Number> the only type argument is out Number.

Since Kotlin 1.1
actual abstract val arguments: List<KTypeProjection>

Type arguments passed for the parameters of the classifier in this type. For example, in the type Array<out Number> the only type argument is out Number.

Since Kotlin 1.3
Link copied to clipboard
expect abstract val classifier: KClassifier?

The declaration of the classifier used in this type. For example, in the type List<String> the classifier would be the KClass instance for List.

Since Kotlin 1.2
actual abstract val classifier: KClassifier?

The declaration of the classifier used in this type. For example, in the type List<String> the classifier would be the KClass instance for List.

Since Kotlin 1.1
actual abstract val classifier: KClassifier?

The declaration of the classifier used in this type. For example, in the type List<String> the classifier would be the KClass instance for List.

Since Kotlin 1.1
actual abstract val classifier: KClassifier?

The declaration of the classifier used in this type. For example, in the type List<String> the classifier would be the KClass instance for List.

Since Kotlin 1.3
Link copied to clipboard
expect abstract val isMarkedNullable: Boolean

true if this type was marked nullable in the source code.

Since Kotlin 1.2
actual abstract val isMarkedNullable: Boolean

true if this type was marked nullable in the source code.

Since Kotlin 1.0
actual abstract val isMarkedNullable: Boolean

true if this type was marked nullable in the source code.

Since Kotlin 1.1
actual abstract val isMarkedNullable: Boolean

true if this type was marked nullable in the source code.

Since Kotlin 1.3

Extensions

Link copied to clipboard

Returns an annotation of the given type on this element.

Since Kotlin 1.1
Link copied to clipboard

Returns all annotations of the given type on this element, including individually applied annotations as well as repeated annotations.

Since Kotlin 1.7
Link copied to clipboard

Returns true if this element is annotated with an annotation of type T.

Since Kotlin 1.4
Link copied to clipboard

Returns true if this type is the same or is a subtype of other, false otherwise.

Since Kotlin 1.1
Link copied to clipboard

Returns true if this type is the same or is a supertype of other, false otherwise.

Since Kotlin 1.1
Link copied to clipboard
@ExperimentalStdlibApi
val KType.javaType: Type

Returns a Java Type instance corresponding to the given Kotlin type.

Since Kotlin 1.4

Returns a Java Type instance corresponding to the given Kotlin type. Note that one Kotlin type may correspond to different JVM types depending on where it appears. For example, Unit corresponds to the JVM class Unit when it's the type of a parameter, or to void when it's the return type of a function.

Since Kotlin 1.0
Link copied to clipboard

Returns the KClass instance representing the runtime class to which this type is erased to on JVM.

Since Kotlin 1.1
Link copied to clipboard

Returns a new type with the same classifier, arguments and annotations as the given type, and with the given nullability.

Since Kotlin 1.1