java - serialVersionUID without L, xxxxxxxxxxxxxxxxxL vs 1L, positive vs negative -


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:

  • serialversionuid seems 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 serialversionuid can positive or negative. difference. again if serialversionuid used purpose of identifying, why need have negative number? have not used positive numbers yet.
  • in mirroredtypedexception.java serialversionuid 269 without l. serialversionuid found without l. why that? meaning of l?

a snapshot (this snapshot doesn't include of them)

enter image description here

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

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -