Annotation Type 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 org.checkerframework.framework.type.QualifierHierarchy or org.checkerframework.framework.type.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.

    • Required Element Summary

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

      • value

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