[Checkers] @DefaultQualifier

Michael Ernst mernst at csail.mit.edu
Wed Jun 25 12:59:57 EDT 2008


Mahmood-

> > @DefaultQualifiers({
> >  @DefaultQualifier("NonNull"), [...]
> > })
> 
> I'm a bit confused.  I thought annotations cannot be values, so cannot  
> be in array without actually annotating something.

In Java, an annotation can have a parameter that is an annotation of a
specific type (JLS, sections 9.6 and 9.7). JLS section 9.7 gives this
example:

  @Author(@Name(first = "Joe", last = "Hacker"))

However, it is not possible to define an annotation that takes an arbitrary
annotation as a parameter, as in

  @DefaultAnnotation(@AnyAnnotation)

More generally, an annotation type cannot have a member of its own type.

                    -Mike



More information about the checkers mailing list