False positive: NullPointerException could be thrown when using springframework util

Then tell us:

  • What language is this for?
  • Which rule?
    It’s shows up as a bug in SonarQube :

A “NullPointerException” could be thrown; “parameters” is nullable here.

And as a rule in SonarLint:

Null pointers should not be dereferenced.

  • Why do you believe it’s a false-positive/false-negative?
    I believe it’s a false-positive

We are using SonarQube Community Edition Version 9.9.1 (build 69595)
Also SonarLint plugin In Intellij IDEA.

  • Reproduction:

if (isEmpty(parameters) || !Objects.equals(parameters.get(0), test))) {

if (!isEmpty(results)) { results.stream() … }

Idk if I’m doing something wrong :slight_smile:
Thanks in advance :slight_smile:

Hey there.

Can you provide a more complete reproducer?

I will look into it when I have the time :slight_smile:

1 Like