[Checkers] Nullness checker

Mahmood Ali mahmood at MIT.EDU
Mon Mar 23 14:52:28 EDT 2009


>> AnnotationValueVisitor needs to be declared as:
>> interface AnnotationValueVisitor<R extends @Nullable Object, P  
>> extends @Nullable Object> { ... }
> Ok, thanks :)
> Why can't I write @Nullable R, but instead there's R extends  
> @Nullable Object? Is it because of current implementation, or some  
> deeper requirement?
Actually, these have different semantics in the following way:

R extends @Nullable Object:
    R could be any reference type whether nullable or nonnull.  Any  
use of R would be substitude with the proper type (e.g. @NonNull  
String, @Nullable Date).

@Nullable R
   R could be any nullable reference type, and it couldn't represent  
nonnull types.  Any use of R would be replaced with a nullable version  
of the proper type (e.g. @Nullable String, @Nullable Date).


More information about the checkers mailing list