Cause
Recently in the company to hit the code when accidentally found previously left enum class implemented the Serializable interface, and then wrote a serialversionuid ... I've never used it in an enumeration class before. Feel a bit magical .... So Baidu went under and tested himself under. This article was recorded
Specific content enumeration By default implements the Serializable interface
After Baidu found that the enumeration class by default is the implementation of the serialized interface, so when declaring the enumeration type, there is no need for additional impl Serializable.
Enum classes don't need to write serialversionuid themselves.
The enumeration class does not need to define the SERIALVERSIONUID, nor is it necessary, the default is 0, even if you write your own serialversionuid, that is 0.
This is the conclusion of the experiment, the specific test process look at the back.
To test the serialversionuid of an enumeration class
The calculation Serialversionuid is using Serialver
Serialver-show
Serialversionuid of the Java enumeration class