IJPL-207563 Remove PersistentStateComponent from ProjectRootManagerImpl

GitOrigin-RevId: c2fd14ed07ae5e9d397ebbc5c7c277a632026a92
This commit is contained in:
Ilya Korennoy
2025-10-09 13:12:23 +00:00
committed by intellij-monorepo-bot
parent dcf718d5e8
commit 9950569576
5 changed files with 3 additions and 35 deletions
@@ -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)
}
}
}
@@ -461,7 +461,7 @@ private class StateGetterImpl<S : Any>(
null
}
val serializedStateAfterLoad = if (stateAfterLoad == null || stateAfterLoad == HandledByWSM) {
val serializedStateAfterLoad = if (stateAfterLoad == null) {
serializedState
}
else {
@@ -17057,7 +17057,6 @@ f:com.intellij.webcore.packaging.PackagingErrorDialog
- <init>(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
- <init>(com.intellij.openapi.project.Project,kotlinx.coroutines.CoroutineScope):V
f:com.intellij.workspaceModel.ide.impl.legacyBridge.project.ProjectRootManagerBridge$ModuleDependencyListenerImpl
@@ -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__")
@@ -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<ProjectExtension>("com.intellij.
open class ProjectRootManagerImpl(
@JvmField val project: Project,
@JvmField protected val coroutineScope: CoroutineScope,
) : ProjectRootManagerEx(), PersistentStateComponent<Element> {
) : ProjectRootManagerEx() {
private val projectJdkEventDispatcher = EventDispatcher.create(ProjectJdkListener::class.java)
private val moduleRootManagerInstances = ConcurrentHashMap<Module, ModuleRootManager>()
@@ -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