Fix NPE during lookup map GC

The cause of the issue is unknown, I was not able to reproduce it as
well

    #KT-24337 fixed
This commit is contained in:
Alexey Tsvetkov
2018-05-18 16:22:16 +03:00
parent eeab271eff
commit 6210df977b
@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
internal class FileToIdMap(file: File) : BasicMap<File, Int>(file, FileKeyDescriptor, IntExternalizer) {
@@ -34,5 +33,12 @@ internal class FileToIdMap(file: File) : BasicMap<File, Int>(file, FileKeyDescri
storage.remove(file)
}
fun toMap(): Map<File, Int> = storage.keys.keysToMap { storage[it]!! }
fun toMap(): Map<File, Int> {
val result = HashMap<File, Int>()
for (key in storage.keys) {
val value = storage[key] ?: continue
result[key] = value
}
return result
}
}