KaSessionComponent¶
@SubclassOptInRequired(markerClass = [KaSessionComponentImplementationDetail::class])
interface KaSessionComponent : KaLifetimeOwner
A component of a KaSession.
Session components mix functions and properties into the session, which allows using them directly from an analyze block where a KaSession is available as a receiver. As such, functions from session components define a large part of the Analysis API's surface, in addition to other lifetime owners like KaSymbol.
Important: Any public function or property in a "session component" is directly available in a KaSession context. There is no need to first retrieve the session component in any way.
Example¶
While symbol is actually a property from the KaSymbolProvider session component, it is usable directly in the KaSession context because the property has been mixed into the session.
All public API components inherited from KaSessionComponent are expected to be direct children of KaSessionComponent. That's required for the correctness of the Analysis API context parameter bridge checker, which ensures that each API endpoint from session components has a corresponding context parameter bridge in the same file.
Inheritors¶
KaAnalysisScopeProviderKaCompilerFacilityKaCompilerPluginGeneratedDeclarationsProviderKaCompletionCandidateCheckerKaDataFlowProviderKaDiagnosticProviderKaEvaluatorKaExpressionInformationProviderKaExpressionTypeProviderKaJavaInteroperabilityComponentKaKDocProviderKaReferenceShortenerKaRendererKaResolveExtensionInfoProviderKaResolverKaScopeProviderKaSignatureSubstitutorKaSourceProviderKaSubstitutorProviderKaSymbolInformationProviderKaSymbolRelationProviderKaTypeCreatorKaTypeCreatorProviderKaTypeInformationProviderKaTypeProviderKaTypeRelationCheckerKaVisibilityCheckerKaSymbolProvider
Properties¶
token¶
abstract val token: KaLifetimeToken
The KaLifetimeToken which determines the lifetime of the lifetime owner.
Functions¶
assertIsValidAndAccessible¶
inline fun KaLifetimeOwner.assertIsValidAndAccessible()
isValid¶
fun KaLifetimeOwner.isValid(): Boolean
Whether the lifetime owner is still valid, i.e. we are still in the scope of the lifetime owner's regular lifetime.
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.