I have this DTO class:
class DTO{
private String a;
public DTO(String a){
this.a = a;
}
}
I am JSON serializing this class using Gson and sending it over to other application.
I don't need getters for this class. For this class sonar is showing following issue:
"Remove this unused "a" private field."
Should I ignore this sonar issue or there is another ideal way to change my code to eliminate this sonar error?
The issue raised by SonarQube is a false positive in this example. Your best course of action is to mark it as such on SonarQube.
If your DTO files follow a consistent naming pattern, then it could also be interesting to configure SonarQube to ignore this issue in those files by default.