#2160 (comment)
Affects PMD Version:
6.20.0
Rule:
LawOfDemeter.
Description:
Static property access warning must not be flagged for Law of Demeter when it can be mitigated by static import. The access of a static property is double-counted; the dot accessor count must start from the static property, not the class in which it exists. A very special case for this would be the static property at the class level 'class'. This should be treated as a global variable as well.
Code Sample demonstrating the issue:
package pmdtests;
import java.util.concurrent.TimeUnit;
import static java.util.concurrent.TimeUnit.SECONDS;
public enum Test {
;
public static void main(String[] args) {
try {
TimeUnit.MILLISECONDS.sleep(300);
SECONDS.sleep(2);
} catch (InterruptedException ie) {
System.err.println(ie);
}
}
}
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
#2160 (comment)
Affects PMD Version:
6.20.0
Rule:
LawOfDemeter.
Description:
Static property access warning must not be flagged for Law of Demeter when it can be mitigated by static import. The access of a static property is double-counted; the dot accessor count must start from the static property, not the class in which it exists. A very special case for this would be the static property at the class level 'class'. This should be treated as a global variable as well.
Code Sample demonstrating the issue:
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]