IntelliJ IDEA generating serialVersionUID

Without any plugins: You just need to enable highlight in IntelliJ:

IntelliJ Preferences -> Editor -> Inspections -> Java -> Serialization issues -> Serializable class without 'serialVersionUID' - set flag and click 'OK'.

Now, if your class implements Serializable, you will see highlight, and alt+Enter on class name will propose to generate private static final long serialVersionUID.

PS: Taken from here


Install the GenerateSerialVersionUID plugin by Olivier Descout.

Go to: menu FileSettingsPluginsBrowse repositoriesGenerateSerialVersionUID

Install the plugin and restart.

Now you can generate the id from menu CodeGenerate → serialVersionUID` or the shortcut.


I am not sure if you have an old version of IntelliJ IDEA, but if I go to menu FileSettings...InspectionsSerialization issues → Serializable class without 'serialVersionUID'` enabled, the class you provide give me warnings.

Enter image description here

If I try the first class I see:

Enter image description here

BTW: It didn't show me a warning until I added { } to the end of each class to fix the compile error.