[Checkers] QualifierRoot and "SubtypeOf unqualified"

Michael Ernst mernst at csail.mit.edu
Thu Jun 12 03:36:44 EDT 2008


OK, that sounds good.

Users can write have

  @SubtypeOf({Unqualified.class})

and

  @SubtypeOf({})

and both of these must be documented in the @SubtypeOf Javadoc as special
cases.  (And @Unqualified will have Javadoc as well, of course.)

The checkers should throw an error if an annotation listed in
@TypeQualifiers (or with a @TypeQualifier meta-annotation?) does not have a
@SubtypeOf meta-annotation.

@QualiferRoot goes away.  

> >    * With respect to "Void.class", Mahmood said, "it would be nice  
> > to make
> >      SubtypeOf accept class<? extends Annotation>".  Can you explain?
> Currently, SubtypeOf is declared as:
> @interface SubtypeOf { Class<? extends Annotation>[] value(); }

Oh, I see:  accept arguments of that type.  (I was interpreting it as
"accept that as an argument".)  Thanks!

> Actually, the same problem goes to Default, as its value accepts the  
> fully qualified name as a String, rather than the class itself.
> con: compiler does not enforce or check that the passed string is  
> actually a valid class let alone an annotation
> pro: It doesn't require annotation to always be in the classpath.   
> This problem isn't relevant to the annotation itself.

Why isn't this problem relevant to the annotation itself?  If code has
annotations, then the annotation definition must be on the classpath.
Otherwise, a user can write @Default in a comment using the backward
compatibility settings.

                    -Mike



More information about the checkers mailing list