SonarLint V3: Fields in a “Serializable” class should either be transient or serializable for List interface

主宰稳场 提交于 2019-12-01 19:04:48

SonarLint is right. The problem is that there is no guarantee that elements field is serializable. You need to add type bound on T type like this

public class Page<T extends Serializable> implements Serializable {}

This way the list will be serializable if implementation chosen for it is serializable (which is true for standard collection types in Java).

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