简体   繁体   中英

Same serialversionUID for same installed Java versions

I have a simple question, which wasn't cleared properly by Googling: If I install the same Java binary onto different computers, will their serialversionUID remain the same? If no, then other than explicitly changing, is their any mechanism wherein the serialversionUID's are different? Thanks for the explanation. (This is a link to the algorithm which generates the UID: algorithm )

Yes, because the serialVersionUIDs are just a member variables set to static values, and you didn't recompile the binaries between placing them on the first machine and the second.

It is the serialization / deserialization architecture which concerns itself with serialVersionUIDs, at run time. If one modifies the source code of a class with a serialVersionUID, they are supposed to review the class for serialization compatibility with the unmodified version, and if incompatible, adjust the serialVerisonUID to an yet-unused value for that class.

“流唯一标识符是类名,接口类名,方法和字段的64位散列”,如果您没有更改类代码,它应该完全相同。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM