Sonar / Constructor Calls Overridable Method
How to fix the Sonar’s following report?
[java]Constructor Calls Overridable Method [/java]
In the constructor of your class, assign the parameters to the right fields using the ‘=’ operator, and not the setXXX() methods. Indeed, the latter may be overriden by subclass.
Eg:
Replace:
[java]public Constructor(Param param){
setField(param);
}[/java]
With:
[java]public Constructor(Param param){
this.field = param;
}[/java]