报告 readObjectwriteObject 方法未声明为 private 的 Serializable 类。 这些方法的可见性没有理由比 private 更高。

建议通过快速修复使相应的方法为 private

示例:


  public class Test implements Serializable {
    public void readObject(ObjectInputStream stream) {
      /* ... */
    }
  }

在应用快速修复后:


  public class Test implements Serializable {
    private void readObject(ObjectInputStream stream) {
      /* ... */
    }
  }