When I used Eclipse it had a nice feature to generate serial version UID.
But what to do in IntelliJ?
How to choose or generate identical serial version UID in IntelliJ?
And what to do when you modify old class?
If you haven't specify the id
, it is generated at runtime...
This question is related to
java
serialization
intellij-idea
Install GenerateSerialVersionUID plugin
with in the code editor, Open the class you want to create the UID for , Right click -> Generate -> SerialVersionUID. You may need to have the GenerateSerialVersionUID plugin installed for this to work.
IntelliJ IDEA Plugins / GenerateSerialVersionUID https://plugins.jetbrains.com/plugin/?idea&id=185
very nice, very easy to install. you can install that from plugins menu, select install from disk, select the jar file you unpacked in the lib folder. restart, control + ins, and it pops up to generate serial UID from menu. love it. :-)
Easiest method: Alt
+Enter
on
private static final long serialVersionUID = ;
IntelliJ will underline the space after the =
. put your cursor on it and hit alt
+Enter
(Option
+Enter
on Mac). You'll get a popover that says "Randomly Change serialVersionUID Initializer". Just hit enter, and it'll populate that space with a random long.
Source: Stackoverflow.com