Back to Intellij Community

SerialPersistentFieldsWithWrongSignature

java/java-impl/resources/inspectionDescriptions/SerialPersistentFieldsWithWrongSignature.html

2025.3-rc-2464 B
Original Source

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)};

  }