The serialVersionUID is a unique identifier that is used to serialize and deserialize an object of a Serializable class in Java.
It helps to verify ๐ต๏ธ that the sender and receiver of a serialized object have loaded classes that are compatible ๐ค with respect to serialization.
If the serialVersionUID of the sender and receiver classes do not match, an InvalidClassException โ will be thrown.
The serialVersionUID can be either declared explicitly by the programmer ๐งโ๐ป, or generated automatically by the Java Virtual Machine (JVM) โ๐ค based on the class definition.
โ๏ธ However, it is recommended to declare the serialVersionUID explicitly, as the default value may vary depending on the JVM platform and version.
To declare the serialVersionUID explicitly on IntelliJ, you can use the following method:
๐๐ฅ๐ญ+๐๐ง๐ญ๐๐ซ ๐จ๐ง
๐ฉ๐ซ๐ข๐ฏ๐๐ญ๐ ๐ฌ๐ญ๐๐ญ๐ข๐ ๐๐ข๐ง๐๐ฅ ๐ฅ๐จ๐ง๐ ๐ฌ๐๐ซ๐ข๐๐ฅ๐๐๐ซ๐ฌ๐ข๐จ๐ง๐๐๐ = ;
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.
#java #serialization #uuid #programming #intellij
Stackoverflow answer๐ https://stackoverflow.com/questions/24573643/how-to-generate-serial-version-uid-in-intellij#53824823
Udemy๐ https://www.udemy.com/course/ocp-oracle-certified-professional-java-developer-prep/?referralCode=54114F9AD41F127CB99A