Rule: NullAssignment (java, errorprone)
Type type = condition ? something() : null;
This, according to NullAssignment's documentation, should not give the warning but it does.
PMD version 5.8.1.
P.S. Another false positive is:
String key;
if (a) {
key = "a";
} else if (b) {
key = "b";
} else {
key = null;
}
This also should not give the warning.
P.S. Third example:
Type result = someHash.computeIfAbsent(a, _unused -> test ? truthy : null);
Rule: NullAssignment (java, errorprone)
This, according to
NullAssignment's documentation, should not give the warning but it does.PMD version 5.8.1.
P.S. Another false positive is:
This also should not give the warning.
P.S. Third example: