I am using the following method:
boolean isNullOrEmpty(String s) {
return s == null || s.length() == 0;
}
The problem is that it is not compatible with @Nullable. For istance in the following code, a warning appears when it should not.
void test(@Nullable String s) {
if (!isNullOrEmpty(s)) {
s.length();
}
}
Is there a way to make this warning go away while saving isNullOrEmptyand Nullable?
source
share