Affects PMD Version:6.47.0
Rule:NonThreadSafeSingleton
Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_java_multithreading.html#nonthreadsafesingleton
Description:
Hi, I found a false positive about the rule NonThreadSafeSingleton, please read the following code example. In line 3 and line 4, PMD report two warnings, but I think we only need one warning in line 4 is sufficient. Hence, I think this is a false positive. Thanks for your consideration.
Code Sample demonstrating the issue:
private static List buz;
public static List bar() {
if (true) { // the first warning
if (buz == null) // the second warning
buz = new ArrayList();
}
return buz;
}
Expected outcome:
PMD reports a violation at line 3, but that's wrong. That's a false positive.
Running PMD through: [Maven]
Affects PMD Version:6.47.0
Rule:NonThreadSafeSingleton
Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_java_multithreading.html#nonthreadsafesingleton
Description:
Hi, I found a false positive about the rule NonThreadSafeSingleton, please read the following code example. In line 3 and line 4, PMD report two warnings, but I think we only need one warning in line 4 is sufficient. Hence, I think this is a false positive. Thanks for your consideration.
Code Sample demonstrating the issue:
Expected outcome:
PMD reports a violation at line 3, but that's wrong. That's a false positive.
Running PMD through: [Maven]