Skip to content

KaUseSiteVisibilityChecker

The type has been moved to a new package. Use <strong>org.jetbrains.kotlin.analysis.api.visibility.KaUseSiteVisibilityChecker</strong> instead.

Allows checking if KaDeclarationSymbol is visible from the current use-site.

KaUseSiteVisibilityChecker is created by KaVisibilityChecker.createUseSiteVisibilityChecker.

KaUseSiteVisibilityChecker is designed to be reused. Therefore, if you have multiple candidates to check from the same use-site position, it will be more performant to reuse the same KaUseSiteVisibilityChecker.

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.

isVisible

abstract override fun isVisible(candidateSymbol: KaDeclarationSymbol): Boolean

Checks whether the candidateSymbol is visible at the current use-site.

Return

true if the candidateSymbol is visible from the current use-site, false otherwise.

Parameters

  • candidateSymbol: The symbol whose visibility is to be checked.

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.