Skip to content

KaDeclarationContainerSymbol

A KaSymbol which may contain declarations. These declarations may be accessed through the KaScopes provided by KaScopeProvider.

Inheritors

Properties

anchorPsi

abstract val anchorPsi: PsiElement?

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

combinedDeclaredMemberScope

A KaScope containing all members explicitly declared in the given KaDeclarationContainerSymbol.

combinedMemberScope

A KaScope containing all members from memberScope and staticMemberScope.

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:

declaredMemberScope

A KaScope containing the non-static callables (functions, properties, and constructors) and inner classes explicitly declared in the given KaDeclarationContainerSymbol.

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.

delegatedMemberScope

A KaScope containing synthetic callables (functions and properties) created by interface delegation.

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.

memberScope

A KaScope containing non-static callable members (functions, properties, and constructors) and all classifier members (classes and objects) of the given KaDeclarationContainerSymbol. The scope includes members inherited from the symbol's supertypes, in addition to members which are declared explicitly inside the symbol's body.

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.

staticDeclaredMemberScope

A KaScope containing the static callables (functions and properties) and all classifiers (classes and objects) explicitly declared in the given KaDeclarationContainerSymbol.

staticMemberScope

A KaScope containing the static members of the given KaDeclarationContainerSymbol.

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

Functions

assertIsValidAndAccessible

createPointer

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.