From 9950569576aa55596bbc0fdf444e9a072776c7dc Mon Sep 17 00:00:00 2001 From: Ilya Korennoy Date: Wed, 8 Oct 2025 16:44:45 +0200 Subject: [PATCH] IJPL-207563 Remove PersistentStateComponent from ProjectRootManagerImpl GitOrigin-RevId: c2fd14ed07ae5e9d397ebbc5c7c277a632026a92 --- .../src/ComponentStoreImpl.kt | 5 +---- .../src/XmlElementStorage.kt | 2 +- platform/lang-impl/api-dump-unreviewed.txt | 1 - .../openapi/components/migration_helpers.kt | 16 ---------------- .../openapi/roots/impl/ProjectRootManagerImpl.kt | 14 +------------- 5 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 platform/projectModel-api/src/com/intellij/openapi/components/migration_helpers.kt diff --git a/platform/configuration-store-impl/src/ComponentStoreImpl.kt b/platform/configuration-store-impl/src/ComponentStoreImpl.kt index d6a053d30d8d..65e94f3a0f1a 100644 --- a/platform/configuration-store-impl/src/ComponentStoreImpl.kt +++ b/platform/configuration-store-impl/src/ComponentStoreImpl.kt @@ -456,10 +456,7 @@ abstract class ComponentStoreImpl : IComponentStore { if (modificationCountChanged && state != null && isReportStatisticAllowed(stateSpec, storageSpec)) { featureUsageSettingManager.logConfigurationChanged(effectiveComponentName, state) } - - if (state !== HandledByWSM) { - setStateToSaveSessionProducer(state, info, effectiveComponentName, sessionProducer) - } // else: WSM will call setStateToSaveSessionProducer by itself + setStateToSaveSessionProducer(state, info, effectiveComponentName, sessionProducer) } } } diff --git a/platform/configuration-store-impl/src/XmlElementStorage.kt b/platform/configuration-store-impl/src/XmlElementStorage.kt index 7dd5c2d84b9c..606499839f53 100644 --- a/platform/configuration-store-impl/src/XmlElementStorage.kt +++ b/platform/configuration-store-impl/src/XmlElementStorage.kt @@ -461,7 +461,7 @@ private class StateGetterImpl( null } - val serializedStateAfterLoad = if (stateAfterLoad == null || stateAfterLoad == HandledByWSM) { + val serializedStateAfterLoad = if (stateAfterLoad == null) { serializedState } else { diff --git a/platform/lang-impl/api-dump-unreviewed.txt b/platform/lang-impl/api-dump-unreviewed.txt index 68259f7c71b0..b760c0e0d998 100644 --- a/platform/lang-impl/api-dump-unreviewed.txt +++ b/platform/lang-impl/api-dump-unreviewed.txt @@ -17057,7 +17057,6 @@ f:com.intellij.webcore.packaging.PackagingErrorDialog - (java.lang.String,com.intellij.webcore.packaging.PackageManagementService$ErrorDescription):V f:com.intellij.workspaceModel.ide.impl.legacyBridge.project.ProjectRootManagerBridge - com.intellij.openapi.Disposable -- com.intellij.openapi.components.PersistentStateComponent - com.intellij.openapi.roots.ex.ProjectRootManagerEx - (com.intellij.openapi.project.Project,kotlinx.coroutines.CoroutineScope):V f:com.intellij.workspaceModel.ide.impl.legacyBridge.project.ProjectRootManagerBridge$ModuleDependencyListenerImpl diff --git a/platform/projectModel-api/src/com/intellij/openapi/components/migration_helpers.kt b/platform/projectModel-api/src/com/intellij/openapi/components/migration_helpers.kt deleted file mode 100644 index aa45b1393f35..000000000000 --- a/platform/projectModel-api/src/com/intellij/openapi/components/migration_helpers.kt +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.intellij.openapi.components - -import org.jdom.Element -import org.jetbrains.annotations.ApiStatus - - -/** - * Marker object to ease migration from the [PersistentStateComponent] to the WSM. Persistent state component may return [HandledByWSM] from - * its [PersistentStateComponent.getState] implementation as an indication that state exists, but is handled externally (by the WSM). - * - * The main use case is the following: depending on a registry flag, a component may handle its state by itself (and then return the actual - * state) or delegate state handling to the WSM, and then return this object to make sure that the state set by the WSM is not overwritten. - **/ -@ApiStatus.Internal -public val HandledByWSM: Element = Element("__HandledByWSM__") \ No newline at end of file diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerImpl.kt b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerImpl.kt index becd1d3b4eb4..1eab73e6c301 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerImpl.kt +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerImpl.kt @@ -2,8 +2,6 @@ package com.intellij.openapi.roots.impl import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.components.HandledByWSM -import com.intellij.openapi.components.PersistentStateComponent import com.intellij.openapi.components.State import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.extensions.ProjectExtensionPointName @@ -31,7 +29,6 @@ import com.intellij.workspaceModel.ide.WsmProjectSettingsEntityUtils import com.intellij.workspaceModel.ide.WsmSingletonEntityUtils import com.intellij.workspaceModel.ide.impl.legacyBridge.module.roots.ModuleRootComponentBridge import kotlinx.coroutines.CoroutineScope -import org.jdom.Element import org.jetbrains.annotations.ApiStatus import org.jetbrains.jps.model.module.JpsModuleSourceRootType import java.util.concurrent.ConcurrentHashMap @@ -45,7 +42,7 @@ private val EP_NAME = ProjectExtensionPointName("com.intellij. open class ProjectRootManagerImpl( @JvmField val project: Project, @JvmField protected val coroutineScope: CoroutineScope, -) : ProjectRootManagerEx(), PersistentStateComponent { +) : ProjectRootManagerEx() { private val projectJdkEventDispatcher = EventDispatcher.create(ProjectJdkListener::class.java) private val moduleRootManagerInstances = ConcurrentHashMap() @@ -421,15 +418,6 @@ open class ProjectRootManagerImpl( return moduleRootManagerInstances.computeIfAbsent(module) { ModuleRootComponentBridge(module) } } - @ApiStatus.Internal - override fun loadState(element: Element) { - } - - @ApiStatus.Internal - override fun getState(): Element? { - return HandledByWSM - } - @ApiStatus.Internal var isFiringEvent: Boolean = false protected set