From 91b371789e27e46fb918b2914af6301b64faa564 Mon Sep 17 00:00:00 2001 From: Pavel Kirpichenkov Date: Tue, 16 Jun 2020 18:14:18 +0300 Subject: [PATCH] Invalidate library caches on OOCBM with enabled resolution anchors Without forced clean stale references to declarations from source-dependent libraries can be accessed after invalidation, i.e. resolved references can point to incorrect PSI. TBD: more granular invalidation. KT-24309 --- .../kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt index df8f427b1d7..c4de84393a1 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt @@ -49,6 +49,7 @@ import org.jetbrains.kotlin.idea.compiler.IDELanguageSettingsProvider import org.jetbrains.kotlin.idea.core.script.ScriptDependenciesModificationTracker import org.jetbrains.kotlin.idea.core.script.dependencies.ScriptAdditionalIdeaDependenciesProvider import org.jetbrains.kotlin.idea.project.TargetPlatformDetector +import org.jetbrains.kotlin.idea.project.libraryToSourceAnalysisEnabled import org.jetbrains.kotlin.idea.project.useCompositeAnalysis import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.idea.util.ProjectRootsUtil @@ -204,7 +205,7 @@ class KotlinCacheServiceImpl(val project: Project) : KotlinCacheService { project, librariesContext, settings, reuseDataFrom = facadeForSdk, moduleFilter = { it is LibraryInfo }, - invalidateOnOOCB = false, + invalidateOnOOCB = project.libraryToSourceAnalysisEnabled, dependencies = listOf( LibraryModificationTracker.getInstance(project), ProjectRootModificationTracker.getInstance(project)