Hi,
in the following example, squid:S4449 of SonarJava 5.3 complains about a call to Guava's Strings.isNullOrEmpty(s) with
"Annotate the parameter with @javax.annotation.Nullable in method 'isNullOrEmpty' declaration, or make sure that null can not be passed as argument."
package com.example;
import com.google.common.base.Strings;
import javax.annotation.Nullable;
public class S4449 {
public String m(@Nullable String s) {
return Strings.isNullOrEmpty(s) ? "foo" : "bar"; // <-- squid:S4449 complains
}
}
Note that I'm using Guava 25.0-jre here. Guava uses different nullability annotations, the parameter of Strings#isNullOrEmpty is annotated with org.checkerframework.checker.nullness.compatqual.NullableDecl.
I first thought this could be SONARJAVA-2734, so I checked again with a snapshot build from the master branch (commit 47c01ec86d87517886b02e6dde93260cbba900bc) which should have a fix for SONARJAVA-2734, but I got the same error.
Is this a known bug? Any plans to fix it?
Thank you,
Andreas