Skip to content

KaRenderer

@SubclassOptInRequired(markerClass = [KaSessionComponentImplementationDetail::class])
interface KaRenderer : KaSessionComponent

Provides services for rendering declaration symbols and types to strings.

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.

render

abstract fun KaDeclarationSymbol.render(renderer: KaDeclarationRenderer = KaDeclarationRendererForSource.WITH_QUALIFIED_NAMES): String

Renders the given KaDeclarationSymbol to a string. The particular rendering strategy is defined by the renderer.

abstract fun KaType.render(renderer: KaTypeRenderer = KaTypeRendererForSource.WITH_QUALIFIED_NAMES, position: Variance): String

Renders the given KaType into a string. The particular rendering strategy is defined by the renderer.

position controls the way the given type is approximated using KaTypeRenderer.typeApproximator.

Specifically, when KaRendererTypeApproximator.TO_DENOTABLE is used, no approximation is performed for Variance.INVARIANT, a denotable subtype is rendered for Variance.IN_VARIANCE, and a denotable supertype is rendered for Variance.OUT_VARIANCE.

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.