I am trying to use the Eclipse org.eclipse.jdt.annotation.NonNull annotations and i don't understand this
method signature:
@NonNull MyAnnotation java.lang.reflect.Field.getAnnotation(Class<@NonNull MyAnnotation> annotationClass)
for loop:
if(field.getAnnotation(MyAnnotation.class)!=null)
continue;
Eclipse declares the following code dead code
try{
Why does eclipse think the getAnnotation class returns @NonNull?
The docs clearly state it can return null.
I have verified via a debugger that the code is not dead, stepping trough.
EDIT: I do not use @NonNullByDefault on any package
I tried:
- adding
@Nullableto MyAnnotation, i getThe nullness annotation 'Nullable' is not applicable at this location @Nullable MyAnnotation n=field.getAnnotation(MyAnnotation.class);still same problem