diff --git a/platform/workspaceModel-ide/src/com/intellij/workspace/legacyBridge/typedModel/module/RootModelViaTypedEntityImpl.kt b/platform/workspaceModel-ide/src/com/intellij/workspace/legacyBridge/typedModel/module/RootModelViaTypedEntityImpl.kt index d517dcb6d0d3..31d59df20ca8 100644 --- a/platform/workspaceModel-ide/src/com/intellij/workspace/legacyBridge/typedModel/module/RootModelViaTypedEntityImpl.kt +++ b/platform/workspaceModel-ide/src/com/intellij/workspace/legacyBridge/typedModel/module/RootModelViaTypedEntityImpl.kt @@ -38,12 +38,15 @@ internal class RootModelViaTypedEntityImpl(internal val moduleEntityId: Persiste val moduleEntity: ModuleEntity? = storage.resolve(moduleEntityId) - private val orderEntriesArray by lazy { - val moduleEntity = storage.resolve(moduleEntityId) ?: return@lazy emptyArray() - moduleEntity.dependencies.mapIndexed { index, e -> - toOrderEntry(e, index) - }.toTypedArray() - } + private val orderEntriesArray: Array + get() { + // This variable should not be cached unless + // com.intellij.workspace.legacyBridge.intellij.LegacyBridgeModuleRootComponent.moduleLibraries is mutable + val moduleEntity = storage.resolve(moduleEntityId) ?: return emptyArray() + return moduleEntity.dependencies.mapIndexed { index, e -> + toOrderEntry(e, index) + }.toTypedArray() + } val contentEntities: List by lazy { val moduleEntity = storage.resolve(moduleEntityId) ?: return@lazy emptyList()