jborgers / PMD-jPinpoint-rules

PMD rule set for responsible Java and Kotlin coding: performance, sustainability, multi-threading, data mixup and more.
Apache License 2.0
43 stars 10 forks source link

Fix Request for pmd7 AvoidUnguardedMutableInheritedFieldsInSharedObjects false positives #391

Closed jborgers closed 3 weeks ago

jborgers commented 4 weeks ago

If confuses local variables and method parameters with inherited objects.

import org.springframework.stereotype.Service;
@Service
class Issue extends Base {
    Issue(RestTemplate restTemplate) {
        restTemplate.setErrorHandler(); // <--- false positive
    }
    void bar(String text) {
      try {
       } catch (TechnicalException e) {
            e.setText(text); // <--- false positive
       }
    }
}
jborgers commented 4 weeks ago

local variable defined not immediately in the method