explicit serialVersionUID considered harmful?

前端 未结 6 1037
小鲜肉
小鲜肉 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:13

    Changing when it shouldn't may happen for reasons other than class layout changes - the problem is that it's compiler implementation dependent. If you do debug with Eclipse but do production builds with javac, you may end up with two incompatible sets of data.

提交回复
热议问题