Sonarqube is raising false-positive NPE


(Kamil) #1

I have a code

final Comparator<Attachment> comparator = getComparator(sort);
if (nonNull(comparator)) {

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