java:S4276 reports false positive on Supplier<Boolean> which can supply null values

Please provide

  • Operating system: Windows
  • SonarLint plugin version: 9.0.0.75308
  • Programming language you’re coding in: Java
  • Is connected mode used: Yes
    • Connected to SonarQube 9.9 (build 65466)

And a thorough description of the problem / question:

In a method signature

private boolean validate(final Supplier<Boolean> supplier)

Sonarlint raises java:S4276 error. In my case I cannot use BooleanSupplier since the supplier can return null which would lead to an unboxing error using BooleanSupplier.

Sonarlint should not report this.

Best regards
Frank

Hey there.

Thanks for the report. I think this matches a previously reported false-positive tracked here: SONARJAVA-4272

Can you check? :smiley:

Hi Colin,
I think it’s the same kind of issue.