Skip to content

Commit

Permalink
[Repl] Clear java finder caches on adding new dependencies between sn…
Browse files Browse the repository at this point in the history
…ippets

Otherwise, `javaFacade.hasTopLevelClassOf(classId)` in
`JvmClassFileBasedSymbolProvider.computePackagePartInfo` will return
cached `null` in the situation when the dependency class was accessed in
one of the previous snippets without actual dependency
  • Loading branch information
demiurg906 authored and qodana-bot committed Jan 22, 2025
1 parent 8bf1824 commit 53d8749
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import org.jetbrains.kotlin.modules.TargetId
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade
import org.jetbrains.kotlin.scripting.compiler.plugin.ReplCompilerPluginRegistrar
import org.jetbrains.kotlin.scripting.compiler.plugin.dependencies.collectScriptsCompilationDependencies
import org.jetbrains.kotlin.scripting.compiler.plugin.services.FirReplHistoryProviderImpl
Expand Down Expand Up @@ -309,6 +310,7 @@ private fun compileImpl(
languageVersionSettings = compilerConfiguration.languageVersionSettings,
predefinedJavaComponents = state.predefinedJavaComponents,
)
KotlinJavaPsiFacade.getInstance(project).clearPackageCaches()
}

val session = FirJvmSessionFactory.createModuleBasedSession(
Expand Down

0 comments on commit 53d8749

Please sign in to comment.