explicit serialVersionUID considered harmful?

前端 未结 6 1040
小鲜肉
小鲜肉 2020-12-09 02:35

I am probably risking some downvotes on this.

It seems to me that explicitly specifying serialVersionUID for new classes is bad. Consider the two cases of not changi

6条回答
  •  没有蜡笔的小新
    2020-12-09 03:27

    At my work we explicitly prohibit specifying serialVersionUID, exactly because of the problems you bring up.

    In addition, the classes we persist are only used to store data with no logic inside, so the only way they change is because of changing data members.

提交回复
热议问题