Annotation Interface SubtypeOf


@Documented @Retention(RUNTIME) @Target(ANNOTATION_TYPE) @AnnotatedFor("nullness") public @interface SubtypeOf
A meta-annotation to specify all the qualifiers that the given qualifier is an immediate subtype of. This provides a declarative way to specify the type qualifier hierarchy. (Alternatively, the hierarchy can be defined procedurally by subclassing QualifierHierarchy or TypeHierarchy.)

Example:

 @SubtypeOf( { Nullable.class } )
 public @interface NonNull {}
 

For the top qualifier in the qualifier hierarchy (i.e., the qualifier that is a supertype of all other qualifiers in the given hierarchy), use an empty set of values:

 @SubtypeOf( {} )
 public @interface Nullable {}

 @SubtypeOf( {} )
 public @interface MaybeAliased {}
 

Together, all the @SubtypeOf meta-annotations fully describe the type qualifier hierarchy.

See the Checker Framework Manual:
Declaratively defining the qualifier hierarchy
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Class<? extends Annotation>[]
    An array of the supertype qualifiers of the annotated qualifier.
  • Element Details

    • value

      Class<? extends Annotation>[] value
      An array of the supertype qualifiers of the annotated qualifier.