IDEA 添加serialVersionUID 检查

1
2

  1. 根据类名、接口名、成员方法及属性等来生成一个64位的哈希字段,例如 private static final long serialVersionUID = XXXL;

    add default serial version ID: 日后需要进行结构调整的就要手动添加,可以进行向下兼容 private static final long serialVersionUID = XXXL;
      Adds a default serial version ID to the selected type
      Use this option to add a user-defined ID in combination with custom serialization code if the type did undergo structural change since its first release.

  2. 采用默认的1L,具体为private static final long serialVersionUID = 1L;

    add generated serial version ID:java 自动根据算法编译自动生成的,一旦修改类 serialVersionUID就变了,就无法反序列化回来。private static final long serialVersionUID = 1L;
      Adds a generated serial version ID to the selected type
      Use this option to add a compiler-generated ID if the type didnot undergo structural change since its first release.

原文地址:https://www.cnblogs.com/land-fill/p/13475770.html