开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜