Clean JavaClassesTracker and LookupTracker on call RetryWithAdditionalRoots
#KT-38576 Fixed
This commit is contained in:
committed by
Space
parent
62707c9a89
commit
df017ea187
@@ -71,6 +71,11 @@ class JavaClassesTrackerImpl(
|
||||
}
|
||||
}
|
||||
|
||||
override fun clear() {
|
||||
classToSourceSerialized.clear()
|
||||
classDescriptors.clear()
|
||||
}
|
||||
|
||||
private fun JavaClassDescriptor.wasContentRequested() =
|
||||
this.safeAs<LazyJavaClassDescriptor>()?.wasScopeContentRequested() != false
|
||||
}
|
||||
|
||||
@@ -276,6 +276,15 @@ class LookupTrackerImpl(private val delegate: LookupTracker) : LookupTracker {
|
||||
delegate.record(prevFilePath, position, prevScopeFqName, scopeKind, prevName)
|
||||
}
|
||||
}
|
||||
|
||||
override fun clear() {
|
||||
lookups.clear()
|
||||
prevFilePath = ""
|
||||
prevPosition = null
|
||||
prevScopeFqName = ""
|
||||
prevScopeKind = null
|
||||
prevName = ""
|
||||
}
|
||||
}
|
||||
|
||||
data class LookupSymbol(val name: String, val scope: String) : Comparable<LookupSymbol> {
|
||||
|
||||
@@ -21,15 +21,18 @@ import org.jetbrains.kotlin.cli.common.fir.FirDiagnosticsCompilerResultsReporter
|
||||
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
|
||||
import org.jetbrains.kotlin.cli.common.toLogger
|
||||
import org.jetbrains.kotlin.cli.jvm.config.*
|
||||
import org.jetbrains.kotlin.cli.jvm.config.ClassicFrontendSpecificJvmConfigurationKeys.JAVA_CLASSES_TRACKER
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderFactories
|
||||
import org.jetbrains.kotlin.codegen.CodegenFactory
|
||||
import org.jetbrains.kotlin.codegen.DefaultCodegenFactory
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys.LOOKUP_TRACKER
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporterFactory
|
||||
import org.jetbrains.kotlin.diagnostics.impl.BaseDiagnosticsCollector
|
||||
import org.jetbrains.kotlin.extensions.ProcessSourcesBeforeCompilingExtension
|
||||
import org.jetbrains.kotlin.ir.backend.jvm.jvmResolveLibraries
|
||||
import org.jetbrains.kotlin.load.java.JavaClassesTracker
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
|
||||
import org.jetbrains.kotlin.modules.Module
|
||||
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
|
||||
@@ -168,6 +171,12 @@ object KotlinToJVMBytecodeCompiler {
|
||||
|
||||
KotlinJavaPsiFacade.getInstance(environment.project).clearPackageCaches()
|
||||
|
||||
val javaClassesTracker = configuration[JAVA_CLASSES_TRACKER]
|
||||
javaClassesTracker?.clear()
|
||||
|
||||
val lookupTracker = configuration[LOOKUP_TRACKER]
|
||||
lookupTracker?.clear()
|
||||
|
||||
// Clear all diagnostic messages
|
||||
configuration[CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY]?.clear()
|
||||
|
||||
|
||||
@@ -55,6 +55,10 @@ class RemoteLookupTrackerClient(
|
||||
lookups.getOrPut(filePath, ::THashMap).getOrPut(internedSymbolFqName, ::THashSet).add(objectToPut)
|
||||
}
|
||||
|
||||
override fun clear() {
|
||||
lookups.clear()
|
||||
}
|
||||
|
||||
init {
|
||||
eventManager.onCompilationFinished { flush() }
|
||||
}
|
||||
|
||||
+4
@@ -36,6 +36,10 @@ class RemoteLookupTrackerClient(
|
||||
lookups.add(LookupInfo(internedFilePath, position, internedScopeFqName, scopeKind, internedName))
|
||||
}
|
||||
|
||||
override fun clear() {
|
||||
lookups.clear()
|
||||
}
|
||||
|
||||
init {
|
||||
runBlocking {
|
||||
eventManager.onCompilationFinished { flush() }
|
||||
|
||||
@@ -32,12 +32,17 @@ interface LookupTracker {
|
||||
name: String
|
||||
)
|
||||
|
||||
fun clear()
|
||||
|
||||
object DO_NOTHING : LookupTracker {
|
||||
override val requiresPosition: Boolean
|
||||
get() = false
|
||||
|
||||
override fun record(filePath: String, position: Position, scopeFqName: String, scopeKind: ScopeKind, name: String) {
|
||||
}
|
||||
|
||||
override fun clear() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,11 @@ interface JavaClassesTracker {
|
||||
|
||||
fun onCompletedAnalysis(module: ModuleDescriptor)
|
||||
|
||||
fun clear()
|
||||
|
||||
object Default : JavaClassesTracker {
|
||||
override fun reportClass(classDescriptor: JavaClassDescriptor) {}
|
||||
override fun onCompletedAnalysis(module: ModuleDescriptor) {}
|
||||
override fun clear() {}
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -361,6 +361,10 @@ class TestLookupTracker : LookupTracker {
|
||||
|
||||
lookups.add(LookupInfo(internedFilePath, position, internedScopeFqName, scopeKind, internedName))
|
||||
}
|
||||
|
||||
override fun clear() {
|
||||
lookups.clear()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user