Skip to content

KaAnnotatedSymbol

A KaSymbol representing a declaration which may have annotations applied to it.

See also

Inheritors

Properties

anchorPsi

abstract val anchorPsi: PsiElement?

A PsiElement associated with the symbol. Usually, it is the best PsiElement representation for a particular KaSymbol.

annotations

A list of annotations applied to the annotated entity.

containingDeclaration

The KaDeclarationSymbol which contains this symbol, or null if there is no containing declaration:

containingFile

context(session: KaSession)
val KaSymbol.containingFile: KaFileSymbol?

The KaFileSymbol which contains this symbol, or null if this symbol is already a KaFileSymbol, since it has no containing file. Also null for Java and library declarations.

containingModule

context(session: KaSession)
val KaSymbol.containingModule: KaModule

The KaModule which contains this symbol.

containingSymbol

context(session: KaSession)
val KaSymbol.containingSymbol: KaSymbol?

The KaSymbol which contains this symbol, or null if there is no containing declaration:

defaultAnnotationTargets

A set of annotation targets matching for the given symbol, or null if the symbol cannot be annotated. Annotations with one of targets from the returned set can be placed on the KaSymbol without an explicit use-site target.

deprecation

context(session: KaSession)
val KaSymbol.deprecation: KaDeprecation?

The deprecation status of the given symbol, or null if the symbol is not deprecated.

importableFqName

context(session: KaSession)
val KaSymbol.importableFqName: FqName?

A FqName which can be used to import the given symbol, or null if the symbol cannot be imported.

isDeprecated

context(session: KaSession)
val KaSymbol.isDeprecated: Boolean

Whether the symbol is deprecated at any level.

isLocal

Indicates whether a symbol is defined locally within a body.

isTopLevel

Indicates whether a KaSymbol is at the top level.

location

abstract val location: KaSymbolLocation

The kind of location where a symbol is declared in code, e.g. KaSymbolLocation.TOP_LEVEL for top-level declarations.

name

val KaSymbol.name: Name?

The name of the KaSymbol if it has one.

origin

abstract val origin: KaSymbolOrigin

The kind of data source or generation the symbol originates from (e.g. source files, libraries, compiler plugins).

psi

abstract val psi: PsiElement?

The API is obsolete and will be deprecated soon. Use <strong>realPsi</strong> or <strong>anchorPsi</strong> instead.

realPsi

abstract val realPsi: PsiElement?

A PsiElement explicitly present in the code (source or library). This PsiElement is sufficient to restore the symbol via the symbol API without any additional information.

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

Functions

assertIsValidAndAccessible

createPointer

abstract override fun createPointer(): KaSymbolPointer<KaAnnotatedSymbol>

Creates a KaSymbolPointer which can be used to retrieve the symbol in a different analyze block (i.e. a different KaSession).

isValid

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

psi

inline fun <reified PSI : PsiElement> KaSymbol.psi(): PSI

The API is obsolete and will be deprecated soon. Use <strong>realPsi</strong> or <strong>anchorPsi</strong> instead.

psiSafe

inline fun <reified PSI : PsiElement> KaSymbol.psiSafe(): PSI?

The API is obsolete and will be deprecated soon. Use <strong>realPsi</strong> or <strong>anchorPsi</strong> instead.

sourcePsi

inline fun <reified PSI : PsiElement> KaSymbol.sourcePsi(): PSI?

The API is obsolete and will be deprecated soon. Use <strong>realPsi</strong> or <strong>anchorPsi</strong> instead.

sourcePsiSafe

inline fun <reified PSI : PsiElement> KaSymbol.sourcePsiSafe(): PSI?

The API is obsolete and will be deprecated soon. Use <strong>realPsi</strong> or <strong>anchorPsi</strong> instead.

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.