Prevent eager access from implicit initializer and relax thread safety

(cherry picked from commit 958fd7de1db0607b39fae7a7bfe9710b9aece91c)

IJ-MR-130767

GitOrigin-RevId: 5c13abd6f386123a50c18130582fed7c076afb04
This commit is contained in:
Kirill Glazyrin
2024-04-04 16:09:49 -07:00
committed by intellij-monorepo-bot
parent 0a91938036
commit 4ce3f302bb

View File

@@ -17,10 +17,12 @@ import java.lang.ref.Reference
import java.lang.ref.SoftReference
class EditorConfigOptionDescriptorManagerImpl(project: Project) : EditorConfigOptionDescriptorManager {
private val descriptorLoader by lazy { EditorConfigOptionLazyDescriptorLoader(project) }
private val descriptorLoader by lazy(LazyThreadSafetyMode.PUBLICATION) { EditorConfigOptionLazyDescriptorLoader(project) }
// These structures can be very big but are vital for plugin
private val fullySupportedDescriptors = descriptorLoader.fullySupportedDescriptors
private val partiallySupportedDescriptors = descriptorLoader.partiallySupportedDescriptors
private val fullySupportedDescriptors
get() = descriptorLoader.fullySupportedDescriptors
private val partiallySupportedDescriptors
get() = descriptorLoader.partiallySupportedDescriptors
// These structures are relatively small and can be stored via strong reference
private val requiredDeclarationDescriptorsCache = mutableMapOf<String, List<EditorConfigDeclarationDescriptor>>()