Skip to content

Commit 332a961

Browse files
ansmanKSP Auto Pick
authored and
KSP Auto Pick
committed
Close the KSP caches files after reading them
(cherry picked from commit 1290ef8)
1 parent c32a756 commit 332a961

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler-plugin/src/main/kotlin/com/google/devtools/ksp/common/PersistentMap.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ abstract class PersistentMap<K, V>(
5353
@OptIn(ExperimentalSerializationApi::class)
5454
protected fun <K, V> deserialize(serializer: KSerializer<Map<K, V>>, storage: File): MutableMap<K, V> {
5555
return if (storage.exists()) {
56-
Json.decodeFromStream(serializer, storage.inputStream()).toMutableMap()
56+
storage.inputStream().use {
57+
Json.decodeFromStream(serializer, it).toMutableMap()
58+
}
5759
} else {
5860
mutableMapOf()
5961
}

0 commit comments

Comments
 (0)