[LL FIR] KT-58257 Keep library (source) sessions on global source invalidation

- `LLFirSessionCache.sourceCache` can contain library and library
  sources sessions. However, global source modification events should
  not remove such sessions from the cache, because they belong to
  "stable" modules.
- The commit introduces the term "stable module" as a combined term for
  binary and library source modules. Library sources are not binaries,
  but nevertheless they cannot cause nor be affected by out-of-block
  modification.
- The term "source modules" as used by global "source" modification is
  slightly imprecise, as it does *not* include library sources, but for
  the sake of conciseness, I don't plan to change that.
This commit is contained in:
Marco Pennekamp
2023-07-12 21:53:42 +02:00
committed by Space Team
parent edadfd0daa
commit 24045067bf
8 changed files with 41 additions and 26 deletions
@@ -28,8 +28,8 @@ public abstract class KotlinGlobalModificationService {
public abstract fun publishGlobalModuleStateModification()
/**
* Publishes an event of global out-of-block modification of all [KtModule]s, including binary modules. The event does not invalidate
* module state like [publishGlobalModuleStateModification], so some module structure-specific caches might persist.
* Publishes an event of global out-of-block modification of all [KtModule]s. The event does not invalidate module state like
* [publishGlobalModuleStateModification], so some module structure-specific caches might persist.
*/
@TestOnly
public abstract fun publishGlobalOutOfBlockModification()
@@ -9,8 +9,7 @@ import org.jetbrains.kotlin.analysis.project.structure.KtModule
public fun interface KotlinGlobalModuleStateModificationListener {
/**
* [onModification] is invoked in a write action before or after global modification of the module state of all [KtModule]s, including
* binary modules.
* [onModification] is invoked in a write action before or after global modification of the module state of all [KtModule]s.
*
* This event is published after SDK removal and to invalidate caches during/between tests.
*/
@@ -9,8 +9,7 @@ import org.jetbrains.kotlin.analysis.project.structure.KtModule
public fun interface KotlinGlobalOutOfBlockModificationListener {
/**
* [onModification] is invoked in a write action before or after global out-of-block modification of all [KtModule]s, including binary
* modules.
* [onModification] is invoked in a write action before or after global out-of-block modification of all [KtModule]s.
*
* This event is published to invalidate caches during/between tests.
*/
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.analysis.project.structure.KtModule
public fun interface KotlinGlobalSourceModuleStateModificationListener {
/**
* [onModification] is invoked in a write action before or after global modification of the module state of all source [KtModule]s,
* excluding binary modules.
* excluding [stable][org.jetbrains.kotlin.analysis.project.structure.isStableModule] modules.
*
* This event is published to invalidate caches during/between tests.
*/
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.analysis.project.structure.KtModule
public fun interface KotlinGlobalSourceOutOfBlockModificationListener {
/**
* [onModification] is invoked in a write action before or after global out-of-block modification of all source [KtModule]s, excluding
* binary modules.
* [stable][org.jetbrains.kotlin.analysis.project.structure.isStableModule] modules.
*
* This event is published on global PSI changes.
*/