#2160 (comment)
Affects PMD Version:
6.20.0.
Rule:
LawOfDemeter.
Description:
Assigning an instance or local variables (created locally) should not be flagged as an object created elsewhere by this rule.
Code Sample demonstrating the issue:
package pmdtests;
public class AddressUsingCopyOnWrite {
private volatile AddressValue addressValue;
public AddressUsingCopyOnWrite(String street, String city, String phone) {
this.addressValue = new AddressValue(street, city, phone);
}
// thread-safe method
@Override
public String toString() {
AddressValue local = addressValue;
return "street=" + local.getStreet() + ",city=" + local.getCity()
+ ",phoneNumber=" + local.getPhoneNumber();
}
}
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
#2160 (comment)
Affects PMD Version:
6.20.0.
Rule:
LawOfDemeter.
Description:
Assigning an instance or local variables (created locally) should not be flagged as an object created elsewhere by this rule.
Code Sample demonstrating the issue:
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]