java - serialVersionUID without L, xxxxxxxxxxxxxxxxxL vs 1L, positive vs negative -
this question has answer here:
i read what serialversionuid , why should use it? , static final long serialversionuid = 1l. these 2 posts have rough idea of is. id serializable class used check if sender , receiver compatible during deserialization. if not invalidclassexception thrown.
however curious few things:
serialversionuidseems divided 2 "type". 19 numbers followed l xxxxxxxxxxxxxxxxxxxl or 269l or 1l. these numbers don't seem arbitrarily chosen. if need id wouldn't number work? logic behind design.- for 20 characters long
serialversionuidcan positive or negative. difference. again ifserialversionuidused purpose of identifying, why need have negative number? have not used positive numbers yet. - in
mirroredtypedexception.javaserialversionuid269 withoutl.serialversionuidfound withoutl. why that? meaning ofl?
a snapshot (this snapshot doesn't include of them)
serialversionuid seems can divide 2 "type"
not really. they're longs.
for 20 characters long serialversionuid can positive or negative.
these randomly chosen. if randomly choose number between long.min_value , long.max_value of time have 19 digits, , half time negative.
sometimes might generated hash of (e.g. sourcecode, xml definition, etc.). if hash function good, distribution of numbers same if choosing randomly.
why that? meaning of l?
l identifies literal of type long. it's not needed 269, because fits in range of int, , automatically upcast long.

Comments
Post a Comment