#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]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4