pmd rule overridable method called during object construction
I am initializing some member variables in my DTO via sette开发者_Python百科rs from inside the constructor.
But the below pmd error showing so how to eliminate that pmd rule violation?
Overridden method 'setAbc' called during object construction
class A{
private String x;
public getX(){
return x;
}
public setX(String x){
this.x = x ;
}
A(){}
A(B b){
setX("C");
}
}
How about making method setX
final? Or perhaps event the entire class?
精彩评论