Annotation Interface RelevantJavaTypes


@Documented @Retention(RUNTIME) @Target(TYPE) @Inherited public @interface RelevantJavaTypes
An annotation on a SourceChecker subclass to specify which Java types are processed by the checker. In source code, the checker's type qualifiers may only appear on the given types and their subtypes. If a checker is not annotated with this annotation, then the checker's qualifiers may appear on any type.

In order for this annotation to have an effect, it must be placed on the declaration of a class that extends org.checkerframework.framework.source.SourceChecker. org.checkerframework.framework.source.SourceChecker#getRelevantJavaTypes collects these annotations from the checker's class hierarchy, so a subclass inherits and combines the relevant Java types of its superclasses.

This restriction is coarse-grained in that it applies to all type annotations for a given checker. To have different restrictions for different Java types, override org.checkerframework.common.basetype.BaseTypeVisitor#visitAnnotatedType(List, Tree).

This is orthogonal to Java's @Target annotation; each enforces a different type of restriction on what can be written in source code.

See the Checker Framework Manual:
Relevant Java types
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Class<?>[]
    Classes where a type annotation supported by this checker may be written.
  • Element Details

    • value

      Class<?>[] value
      Classes where a type annotation supported by this checker may be written.

      Object[].class means that the checker processes all array types. No distinction among array types is currently made, and no other array class should be supplied to @RelevantJavaTypes.

      If a checker processes both primitive and boxed types, both must be specified separately, for example as int.class and Integer.class.

      Returns:
      classes where a type annotation supported by this checker may be written