Skip to content

KaLifetimeOwner

interface KaLifetimeOwner

An Analysis API entity with a lifetime bound to the KaSession where the entity was created.

The most common lifetime owners are symbols and types, but there are many additional kinds of lifetime owners created by the Analysis API which aren't symbols or types.

See the documentation for KaSession to find out more about lifetime management.

Inheritors

Properties

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

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.

isValid does not check whether the lifetime owner is accessible.

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.

All public endpoints of the Analysis API are protected by validity assertions to ensure that lifetime owners aren't misused outside the scope of their regular lifetime.