My question is very similar to this except that this issue I have encountered in SonarLint V3 (squid:S1948).
My code is :
public class Page
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).