diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirSelfImportingScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirSelfImportingScope.kt index 4a636eeb497..7a4e32fb719 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirSelfImportingScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirSelfImportingScope.kt @@ -5,7 +5,6 @@ package org.jetbrains.kotlin.fir.scopes.impl -import com.intellij.util.containers.ContainerUtil import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.resolve.FirSymbolProvider import org.jetbrains.kotlin.fir.scopes.FirPosition @@ -19,26 +18,19 @@ class FirSelfImportingScope(val fqName: FqName, val session: FirSession) : FirSc private val symbolProvider = FirSymbolProvider.getInstance(session) - private val cache = ContainerUtil.newConcurrentMap() - private val absentKeys = ContainerUtil.newConcurrentSet() + private val cache = mutableMapOf() override fun processClassifiersByName( name: Name, position: FirPosition, processor: (ConeClassifierSymbol) -> Boolean ): Boolean { + if (name.asString().isEmpty()) return true - if (name in absentKeys) return true - val symbol = cache[name] ?: run { + val symbol = cache.getOrPut(name) { val unambiguousFqName = ClassId(fqName, name) - val computed = symbolProvider.getClassLikeSymbolByFqName(unambiguousFqName) - if (computed == null) { - absentKeys += name - } else { - cache[name] = computed - } - computed + symbolProvider.getClassLikeSymbolByFqName(unambiguousFqName) } return if (symbol != null) {