mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
IJPL-172041 Use concurrent weak map in ClearableClassValue instead of ordinary weak set
GitOrigin-RevId: 6a330727de43a5c257971925d317b934aabd1b3f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1e3b46d241
commit
f73fc4606e
@@ -10,17 +10,17 @@ import org.jetbrains.annotations.ApiStatus
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
abstract class ClearableClassValue<T> : ClassValue<T>() {
|
||||
private val typeCache = ContainerUtil.createWeakSet<Class<*>>()
|
||||
private val typeCache = ContainerUtil.createConcurrentWeakMap<Class<*>, Unit>()
|
||||
|
||||
fun clear() {
|
||||
for (clazz in typeCache) {
|
||||
for (clazz in typeCache.keys) {
|
||||
remove(clazz)
|
||||
}
|
||||
typeCache.clear()
|
||||
}
|
||||
|
||||
protected override fun computeValue(aClass: Class<*>): T? {
|
||||
typeCache.add(aClass)
|
||||
typeCache.put(aClass, Unit)
|
||||
return computeValueImpl(aClass)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user