Inspectopedia Help

'serialPersistentFields' field not declared 'private static final ObjectStreamField[]'

Reports Serializable classes whose serialPersistentFields field is not declared as private static final ObjectStreamField[].

If a serialPersistentFields field is not declared with those modifiers, the serialization behavior will be as if the field was not declared at all.

Example:

class List implements Serializable { private List next; ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("next", List.class)}; }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023