[Analysis API] fix possible leaks of FirDeclarations from cache keys in KtSymbolByFirBuilder

If some FirDeclarations is inaccessible then there is no reason to store KtSymbol for it

^KTIJ-22749
This commit is contained in:
Ilya Kirillov
2023-02-06 17:06:45 +01:00
committed by teamcity
parent f5e5a134e7
commit 69e41e19e7
@@ -608,7 +608,7 @@ internal class KtSymbolByFirBuilder constructor(
private class BuilderCache<From, To : KtSymbol> {
private val cache = ContainerUtil.createConcurrentSoftMap<From, To>()
private val cache = ContainerUtil.createWeakKeySoftValueMap<From, To>()
inline fun <reified S : To> cache(key: From, calculation: () -> S): S {
val value = cache.getOrPut(key, calculation)