Inspectopedia 2026.3 Help

Persistent state property is not serialized

Reports a property of a persistent state class that the store does not save.

Write each setting in one of these two forms.

  • An immutable state. Keep the property read-only, and put a store annotation from com.intellij.util.xmlb.annotations on the field, for example @Property, @OptionTag, @Attribute, @XCollection, or @XMap. Add @JvmField in Kotlin, so the annotation lands on the field. Use this form with SerializablePersistentStateComponent and a data class.

  • A mutable state. Make the property public and mutable. Use var in Kotlin, or a public non-final field in Java. The store binds such a property with no annotation. Use this form with BaseState.

Put a store annotation on the field, not on the getter. An annotation on a getter alone does not create a binding, because the store needs a setter to load the value back.

Choose the annotation by the type of the property. Use @XCollection for a collection and @XMap for a map, because each one states the shape of the XML. @Property fits every other type.

When the store must skip the property, mark it with @Transient from com.intellij.util.xmlb.annotations.

A property in any other form looks correct, but the store writes nothing for it. The property takes its default value again after each IDE restart, and the user loses the setting. The store gives no warning, so this defect stays hidden until a user reports the data loss.

Note: com.intellij.configurationStore.Property is a different annotation. It holds a description, and the store does not save a property because of it.

Example (Kotlin):

@State(name = "MySettings", storages = [Storage("my.xml")]) class MySettings : SerializablePersistentStateComponent<MySettings.State>(State()) { data class State( @JvmField val showTimestamp: Boolean = true, // bad: no store annotation @JvmField @Property val showSource: Boolean = true, // good: an immutable state ) }
class MyState : BaseState() { var showTimestamp: Boolean = true // good: a mutable state }

Example (Java):

public final class State { public final boolean showTimestamp = true; // bad: final, and no store annotation public boolean showSource = true; // good }

The inspection accepts two more forms, because the rules above do not apply to them:

  • A read-only property of a class that carries @kotlinx.serialization.Serializable. kotlinx.serialization replaces the bean binding of such a class, and it saves a read-only property. Do not add this annotation to an existing state class only to keep a read-only property. It writes the state as JSON, so the store cannot read a settings file that a user already saved.

  • A member that holds a dependency of the component, for example a Project, a CoroutineScope or a Flow. The store cannot write a value of such a type, so leave the member read-only.

The inspection reports only a member that the store can see. It does not report a Kotlin private var or protected var property.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

PersistentStatePropertyNotSerialized
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Plugin DevKit | Code

New in 2026.3

Inspection ID: PersistentStatePropertyNotSerialized

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection PersistentStatePropertyNotSerialized

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2026.3, Qodana for JVM 2026.3,

Last modified: 20 November 2026