SonarQube giving a "Fields in a "Serializable" class should either be transient or serializable" when class is serializable?

huangapple 未分类评论45阅读模式
英文:

SonarQube giving a "Fields in a "Serializable" class should either be transient or serializable" when class is serializable?

问题

public class ClassName implements Serializable {

private static final long serialVersionUID = 1L;

private Map<String, Object> variableName;

在上面的代码中,SonarQube 提出了 CRITICAL 级别的问题,原因是 variableName。我知道 Object 是不可序列化的,但是否有解决办法来避免或解决这个问题呢?

英文:
public class ClassName implements Serializable {

private static final long serialVersionUID = 1L;

private Map&lt;String, Object&gt; variableName;

In the above code, the sonarQube is giving CRITICAL level issue because of variableName. I know Object is not serializable but do anyone have any solution to avoid or resolve this issue.

huangapple
  • 本文由 发表于 2020年4月6日 16:07:42
  • 转载请务必保留本文链接:https://java.coder-hub.com/61055438.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定