generate serialVersionUID using Intellij IDEA : In IntelliJ IDEA, we need to enable this auto-generate serialVersionUID option manually. P.S Tested with IntelliJ IDEA 2019.3.4, it should work the same in other versions.

Intellij IDEA Settings

File -> Settings -> Editor -> Inspections -> Java -> Serialization issues: Find serialization class without serialVersionUID and check it.

Back to the editor, clicks on the class name, ALT + ENTER (Windows), it will prompts the Add serialVersionUID field option.

A new serialVersionUID is auto-generated.

public class Address implements Serializable {

    private static final long serialVersionUID = -2338626292552177485L;

}

References

Laisser un commentaire