Skip to content

KaArrayTypeBuilder

Properties

isMarkedNullable

abstract var isMarkedNullable: Boolean

Whether the resulting array type is marked as nullable, i.e., the type is represented as T?.

Default value: false.

See also

shouldPreferPrimitiveTypes

Whether the builder should try to construct primitive arrays (e.g. IntArray) for primitive types (e.g. Int).

Note that nullable primitive types (e.g. Int?) are not considered primitive, as they are represented as objects. Thus, for these types, the builder will always produce boxed arrays (e.g. Array<Int?>).

Default value: true.

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

variance

abstract var variance: Variance

Variance that should be used for the resulting boxed array (Array<T>). This doesn't affect anything if shouldPreferPrimitiveTypes is set to true and the given element type is primitive.

Default value: Variance.INVARIANT.

Functions

assertIsValidAndAccessible

isValid

Whether the lifetime owner is still valid, i.e. we are still in the scope of the lifetime owner's regular lifetime.

withValidityAssertion

inline fun <R> KaLifetimeOwner.withValidityAssertion(action: () -> R): R

Executes action only if the KaLifetimeOwner is still valid and accessible. Otherwise, throws a validity exception based on the concrete violation.