The following snippet raises a false positive of java:S2259:
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:
null
It seems to affects any generic type where the type parameter allows for null values:
Hello @sithmein Thanks a lot for providing this feedback.
We are reviewing the exact code for the rule (there has been some changes in its code lately), and most probably we will create a ticket to tackle this FP.
I will keep you updated.