Eclipse auto-generation of serialVersionUID with each change

别等时光非礼了梦想. 提交于 2019-11-30 17:34:20

There is no standard functionality in Eclipse to do this.

Jason Gritman

You could update the serial version at build time with the Ant SerialVer task.

the id won't be automatically updated as I change the file unless I do the generation again.

AFAIK default serialVersionUID is just this -- an id generated based on current "shape" of a class. So if you want your id generated when you change anything -- just leave it out.

However, if you want to change serialVersionUID only sometimes -- just change it. Random modification to the id will do.

Random number is only little better than consecutive numbers (if you can assume no one else makes up a class with the same qualified name in your environment), so you may even start from serialVersionUID = 1 and increment this number at will.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!