I'm filtering null and empty strings out of a stream and having some issues with the annotations on Predicate.not. Is there a way to properly annotate Predicate.not to handle this situation with checker?
When I compile the following code I get
```
/home/jpschewe/projects/checker-bugs/src/main/java/net/mtu/eggplant/checker/PredicateNot.java:17: error: [argument] incompatible argument for parameter arg0 of filter.
.filter(Predicate.not(PredicateNot::isBlank)) //
^
found : @Initialized @NonNull Predicate<@Initialized @NonNull String>
required: @Initialized @NonNull Predicate<? extends @Initialized @Nullable Object super @Initialized @Nullable String>
```
```java
package net.mtu.eggplant.checker;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import org.checkerframework.checker.nullness.qual.*;
public class PredicateNot {
public static void function(final @Nullable String @Nullable [] headerRow) {
final Collection<String> headerNames;
if (null == headerRow) {
headerNames = Collections.emptyList();
} else {
headerNames = Arrays.asList(headerRow).stream() //
.filter(Predicate.not(PredicateNot::isBlank)) //
.collect(Collectors.toList());
}
}
// from apache commons lang3 StringUtils
@EnsuresNonNullIf(expression="#1", result=false)
public static boolean isBlank(final @Nullable CharSequence cs) {
if(null == cs) {
return true;
}
final int strLen = length(cs);
if (strLen == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if (!Character.isWhitespace(cs.charAt(i))) {
return false;
}
}
return true;
}
// from apache commons lang3 StringUtils
public static int length(final @Nullable CharSequence cs) {
return cs == null ? 0 : cs.length();
}
}
```