From 4a58274056d8686e06f8edcca4822e6189fd6806 Mon Sep 17 00:00:00 2001 From: Ilya Muradyan Date: Wed, 12 Oct 2022 00:31:47 +0200 Subject: [PATCH] Change PUBLICATION lazy to a storageManager one Lazy computation in publication mode may lead to running of init code many times in parallel, and it actually happens in IDE. Instead, we stick to the option which is used for lazy computations all across compiler code. --- .../src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt index 67df8fd8928..53de8a521bd 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt @@ -43,6 +43,7 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.ImportingScope import org.jetbrains.kotlin.storage.NotNullLazyValue import org.jetbrains.kotlin.storage.StorageManager +import org.jetbrains.kotlin.storage.getValue import org.jetbrains.kotlin.types.expressions.OperatorConventions import org.jetbrains.kotlin.util.collectionUtils.concat import org.jetbrains.kotlin.utils.Printer @@ -126,7 +127,7 @@ open class LazyImportResolver( return importedScopesProvider(directive) ?: ImportingScope.Empty } - val allNames: Set? by lazy(LazyThreadSafetyMode.PUBLICATION) { + val allNames: Set? by components.storageManager.createNullableLazyValue { indexedImports.imports.asIterable().flatMapToNullable(THashSet()) { getImportScope(it).computeImportedNames() } }