I have a code
final Comparator<Attachment> comparator = getComparator(sort);
if (nonNull(comparator)) {
sort(comparator.reversed());
}
where nonNull
is static import to the method:
public static boolean nonNull(final Object o) {
return o != null;
}
And Sonarqube raises:
Null pointers should not be dereferenced
in line sort(comparator.reversed());
while clearly NPE can not happen there