I read What is a serialVersionUID and why should I use it? and static final long serialVersionUID = 1L. From these two SO posts I have a rough idea of what it is. It is an ID for a Serializable class used to check if the sender and receiver are compatible during deserialization. If not a InvalidClassException is thrown.
However I am curious about a few things:
serialVersionUIDseems to be divided into 2 "type". 19 numbers followed by L xxxxxxxxxxxxxxxxxxxL or 269L or 1L. These numbers don't seem arbitrarily chosen. If we simply need an ID wouldn't any number work? what is the logic behind this design.- For the 20 characters long
serialVersionUIDit can be positive or negative. What is the difference. Again ifserialVersionUIDis used for the purpose of identifying, why do we need to have a negative number? We have not used up all the positive numbers yet. - In
MirroredTypedException.javatheserialVersionUIDis 269 without theL. It is the onlyserialVersionUIDI found without theL. Why is that? What is the meaning ofL?
a snapshot (this snapshot doesn't include all of them)
