Skip to content

KaAnnotationList

A list of annotations applied to an entity.

Annotation owners usually implement KaAnnotated.

Properties

classIds

abstract val classIds: Collection<ClassId>

The list of ClassIds of all annotations, in their original order. If the entity has repeatable annotations, classIds may contain the same class ID multiple times.

To check if an annotation is present, use contains instead.

commonSupertype

context(session: KaSession)
val Iterable<KaType>.commonSupertype: KaType

The common supertype of the given KaTypes.

size

abstract override val size: Int

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

Functions

asCompositeScope

context(session: KaSession)
fun List<KaScope>.asCompositeScope(): KaScope

Combines a list of KaScopes into a single composite KaScope. The resulting scope contains all members of its constituent scopes.

assertIsValidAndAccessible

contains

abstract operator override fun contains(element: KaAnnotation): Boolean
abstract operator fun contains(classId: ClassId): Boolean

Checks if the entity contains an annotation with the specified classId.

containsAll

abstract override fun containsAll(elements: Collection<KaAnnotation>): Boolean

get

abstract operator fun get(index: Int): KaAnnotation
abstract operator fun get(classId: ClassId): List<KaAnnotation>

Returns the list of annotations with the specified classId. The same type of annotation may occur multiple times if it is repeatable.

indexOf

abstract fun indexOf(element: KaAnnotation): Int

isEmpty

abstract override fun isEmpty(): Boolean

isValid

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

iterator

abstract operator override fun iterator(): Iterator<KaAnnotation>

lastIndexOf

abstract fun lastIndexOf(element: KaAnnotation): Int

listIterator

abstract fun listIterator(index: Int): ListIterator<KaAnnotation>

subList

abstract fun subList(fromIndex: Int, toIndex: Int): List<KaAnnotation>

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.