From 00d6f42f4054e1c98a89f4490157f7209ee7ff11 Mon Sep 17 00:00:00 2001 From: Jason Pearson Date: Sat, 12 Oct 2024 10:43:45 -0500 Subject: [PATCH] upon clearing the ks object cache, clear retained thread locals --- .../google/devtools/ksp/common/KSObjectCacheManager.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common-util/src/main/kotlin/com/google/devtools/ksp/common/KSObjectCacheManager.kt b/common-util/src/main/kotlin/com/google/devtools/ksp/common/KSObjectCacheManager.kt index f43d6643c6..38f921149d 100644 --- a/common-util/src/main/kotlin/com/google/devtools/ksp/common/KSObjectCacheManager.kt +++ b/common-util/src/main/kotlin/com/google/devtools/ksp/common/KSObjectCacheManager.kt @@ -28,7 +28,10 @@ class KSObjectCacheManager { get() = caches_prop.get() fun register(cache: KSObjectCache<*, *>) = caches.add(cache) - fun clear() = caches.forEach { it.clear() } + fun clear() { + caches.forEach { it.clear() } + caches_prop.remove() + } } } @@ -44,5 +47,8 @@ abstract class KSObjectCache { return cache_prop.get() } - open fun clear() = cache.clear() + open fun clear() { + cache.clear() + cache_prop.remove() + } }