开发者

pmd rule overridable method called during object construction

开发者 https://www.devze.com 2023-04-12 14:08 出处:网络
I am initializing some member variables in my DTO via sette开发者_Python百科rs from inside the constructor.

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

精彩评论

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

关注公众号