0

I have an Entity with a Set of AuditRecords:

private Set<AuditRecord> auditRecords;

AuditRecord implements Serializable.

However the Sonar scan identifies this Set and other Sets in other Entities as Critical issues:

Fields in a "Serializable" class should either be transient or serializable : Make "auditRecords" transient or serializable.

JPA2 supports Sets. Why is this marked as a critical issue?

Timothy S
  • 13
  • 1

2 Answers2

1

java.util.Set does not implement java.io.Serializable: there is no guarantee that the implementation of Set which will be used at run time is serializable. Hence the issue raised by SonarQube.

Mithfindel
  • 4,553
  • 1
  • 23
  • 32
1

This is a bugSONARJAVA-1061, You need to upgrade the sonar-java plugin 3.3 or more.

Downloads sonar-java plugin

see Installing a Plugin

wuwen
  • 51
  • 2