Hi
I use SonarJava 5.4, SonarQube 6.7.1.35068
There is a Assert class with this code:
public static <T> @NonNull T isNotNull( @Nullable T obj ){...}
Those annotations are from org.eclipse.jdt.annotation
, and all packages have the @NonNullByDefault
in package-info.java
Now an error is reported for this code:
private void scanElements(@Nullable ARPACKAGE pk, String parentId) {
ARPACKAGE p = isNotNull(pk);
isNotNull()
is a static import from that Assert class above.
The error shown: squid:S4449
Annotate the parameter with @javax.annotation.Nullable in method ‘isNotNull’ declaration, or make sure that null can not be passed as argument.
In SonarJava 5.4 there was the fix SONARJAVA-2734, but it seems not to cover this situation.
Thanks for looking at this
Frank