public class RegisterRequest implements Serializable {
@NotNull(message = "Register may not be null")
private Object register;
}
I got codeSmell from sonarLing SonarLint: Make "data" transient or serializable.
Because I have Object.class I can't add in this class implements Serializable also I can't transient because I need this object serialize.
How I can fix this codeSmeel by sonar lint?
The thing with Object fields is, those do not implement the
Serializableinterface. SonarQube is saying that you're trying to serialize a field, in this caseObject registerwhich does not implement the interface. For yourregisterfield you should use a custom class which implements theSerializableinterface.Because of this SonarQube is telling you that you should either let
Objectimplement theSerializableinterface (which you can't) or mark it withtransient.