Skip to content

KaSessionProvider

@SubclassOptInRequired(markerClass = [KaImplementationDetail::class])
abstract class KaSessionProvider(val project: Project) : Disposable

Provides KaSessions by use-site PsiElements or KaModules.

This provider should not be used directly. Please use analyze or analyzeCopy instead.

Constructors

KaSessionProvider

constructor(project: Project)

Types

Companion

object Companion

Properties

project

val project: Project

Functions

afterLeavingAnalysis

abstract fun afterLeavingAnalysis(session: KaSession, useSiteElement: PsiElement)

afterLeavingAnalysis hooks into analysis after analyze's action has been executed.

The signature of afterLeavingAnalysis should be kept stable to avoid breaking binary compatibility, since analyze is inlined.

fun afterLeavingAnalysis(session: KaSession, useSiteElement: KtElement)

abstract fun afterLeavingAnalysis(session: KaSession, useSiteModule: KaModule)

This function has the same contracts as afterLeavingAnalysis for PsiElements.

analyze

inline fun <R> analyze(useSiteElement: KtElement, action: KaSession.() -> R): R
inline fun <R> analyze(useSiteElement: PsiElement, action: context(KaSession) () -> R): R
inline fun <R> analyze(useSiteModule: KaModule, action: context(KaSession) () -> R): R

beforeEnteringAnalysis

abstract fun beforeEnteringAnalysis(session: KaSession, useSiteElement: PsiElement)

beforeEnteringAnalysis hooks into analysis before analyze's action is executed.

The signature of beforeEnteringAnalysis should be kept stable to avoid breaking binary compatibility, since analyze is inlined.

fun beforeEnteringAnalysis(session: KaSession, useSiteElement: KtElement)

abstract fun beforeEnteringAnalysis(session: KaSession, useSiteModule: KaModule)

This function has the same contracts as beforeEnteringAnalysis for PsiElements.

clearCaches

abstract fun clearCaches()

dispose

open override fun dispose()

getAnalysisSession

abstract fun getAnalysisSession(useSiteElement: PsiElement): KaSession
fun getAnalysisSession(useSiteElement: KtElement): KaSession
abstract fun getAnalysisSession(useSiteModule: KaModule): KaSession

handleAnalysisException

abstract fun handleAnalysisException(
    throwable: Throwable, 
    session: KaSession, 
    useSiteElement: PsiElement
): Nothing

handleAnalysisException handles any Throwable that occurred during analysis and was caught by analyze.

Errors should generally be rethrown. That said, the signature includes Throwable and not Exception to stay as wide as possible to avoid risking breaking binary compatibility down the line.

The signature of handleAnalysisException should be kept stable to avoid breaking binary compatibility, since analyze is inlined.

fun handleAnalysisException(
    throwable: Throwable, 
    session: KaSession, 
    useSiteElement: KtElement
): Nothing

abstract fun handleAnalysisException(
    throwable: Throwable, 
    session: KaSession, 
    useSiteModule: KaModule
): Nothing

This function has the same contracts as handleAnalysisException for PsiElements.