The following snippet raises a false positive of java:S2259
:
void foo (Map<String, @Nullable String> map) {
map.size(); // "A "NullPointerException" could be thrown; "map" is nullable here.
}
Sonar seems to think that the complete map can be null
when only it’s values can be null
.
Screenshot of a real-world example: