You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Affects PMD Version:
Add new rule to next version Rule:
I'm suggesting adding a new rule UnusedMemberClassVariableRule Description:
Java compiler isn't warning on a non final private member class/ class variable that has no initialization code and is used (thus create a NullPointerException)
Relevant question: https://stackoverflow.com/questions/52810496/avoid-uninitialized-non-final-member-class-class-variable
**Code Sample demonstrating the issue:**
private static Map<String, String> mapStatic; // Missing compile/warning
private Map<String, String> map; // Missing compile/warning
public void put() {
map.put("x", "1"); // NullPointerException
//Map<String, String> mapVar;
//mapVar.put("x", "1"); // Compile The local variable mapVar may not have been initialized
}
static {
mapStatic.put("x", "1"); // NullPointerException
}
Affects PMD Version:
Add new rule to next version
Rule:
I'm suggesting adding a new rule UnusedMemberClassVariableRule
Description:
Java compiler isn't warning on a non final private member class/ class variable that has no initialization code and is used (thus create a NullPointerException)
Relevant question: https://stackoverflow.com/questions/52810496/avoid-uninitialized-non-final-member-class-class-variable
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
The text was updated successfully, but these errors were encountered: