Remove old roots from KotlinScriptDependenciesCLassFinder
Otherwise it may produce an exception that some invalid roots are returned by ScriptClassRootsCache
This commit is contained in:
+8
-2
@@ -114,7 +114,12 @@ class ScriptClassRootsCache(
|
|||||||
when (old) {
|
when (old) {
|
||||||
null -> FullUpdate(this)
|
null -> FullUpdate(this)
|
||||||
this -> NotChanged(this)
|
this -> NotChanged(this)
|
||||||
else -> IncrementalUpdates(this, hasNewRoots(old), getChangedScripts(old))
|
else -> IncrementalUpdates(
|
||||||
|
this,
|
||||||
|
this.hasNewRoots(old),
|
||||||
|
old.hasNewRoots(this),
|
||||||
|
getChangedScripts(old)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hasNewRoots(old: ScriptClassRootsCache): Boolean {
|
private fun hasNewRoots(old: ScriptClassRootsCache): Boolean {
|
||||||
@@ -154,13 +159,14 @@ class ScriptClassRootsCache(
|
|||||||
class IncrementalUpdates(
|
class IncrementalUpdates(
|
||||||
override val cache: ScriptClassRootsCache,
|
override val cache: ScriptClassRootsCache,
|
||||||
override val hasNewRoots: Boolean,
|
override val hasNewRoots: Boolean,
|
||||||
|
private val hasOldRoots: Boolean,
|
||||||
private val updatedScripts: Set<String>
|
private val updatedScripts: Set<String>
|
||||||
) : Updates {
|
) : Updates {
|
||||||
override val hasUpdatedScripts: Boolean get() = updatedScripts.isNotEmpty()
|
override val hasUpdatedScripts: Boolean get() = updatedScripts.isNotEmpty()
|
||||||
override fun isScriptChanged(scriptPath: String) = scriptPath in updatedScripts
|
override fun isScriptChanged(scriptPath: String) = scriptPath in updatedScripts
|
||||||
|
|
||||||
override val changed: Boolean
|
override val changed: Boolean
|
||||||
get() = hasNewRoots || updatedScripts.isNotEmpty()
|
get() = hasNewRoots || updatedScripts.isNotEmpty() || hasOldRoots
|
||||||
}
|
}
|
||||||
|
|
||||||
class FullUpdate(override val cache: ScriptClassRootsCache) : Updates {
|
class FullUpdate(override val cache: ScriptClassRootsCache) : Updates {
|
||||||
|
|||||||
Reference in New Issue
Block a user