Annotation Interface UnannotatedFor
@AnnotatedFor("nullness") but one of its classes has not been annotated with
@Nullable and friends, mark that class @UnannotatedFor("nullness"). The argument
to UnannotatedFor is not an annotation name, but a checker name.
This annotation has no effect unless the
-AuseConservativeDefaultsForUncheckedCode=source or the -AonlyAnnotatedFor command-line
argument is supplied. It only subtracts from the scope of an enclosing AnnotatedFor: an
element in its scope is treated as if no enclosing @AnnotatedFor were present, so its
warnings are suppressed, and under -AuseConservativeDefaultsForUncheckedCode=source it is
also defaulted using conservative defaults. (-AonlyAnnotatedFor suppresses warnings
without changing defaults, the same as for AnnotatedFor.) An @AnnotatedFor on a
nested element takes effect again for that element. Writing both an @AnnotatedFor and an
@UnannotatedFor that name the same checker on one declaration is a warning (
conflicting.annotatedfor), because the two contradict each other; if that warning is suppressed,
the @AnnotatedFor wins, since @UnannotatedFor only subtracts from an
enclosing scope.
Like AnnotatedFor, this annotation is stored in class files and is available via
reflection at run time.
An @UnannotatedFor on a package also applies to subpackages, unless the
applyToSubpackages field is set to false. The innermost package annotation wins: an
@UnannotatedFor on a package excludes its subpackages from an @AnnotatedFor on an
enclosing package, and vice versa.
You may write multiple @UnannotatedFor annotations at the same location, for example
to give two type systems different applyToSubpackages settings on one package:
@UnannotatedFor(value = "nullness", applyToSubpackages = false) @UnannotatedFor(value = "index", applyToSubpackages = true) package mypackage;
- See the Checker Framework Manual:
- Compiling partially-annotated libraries
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceA wrapper annotation that makes theUnannotatedForannotation repeatable. -
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhen used on a package, whether this annotation should also apply to subpackages.
-
Element Details
-
value
String[] valueReturns the type systems for which the annotated element has not been annotated. Legal arguments are any string that may be passed to the-processorcommand-line argument: the fully-qualified class name for the checker, or a shorthand for built-in checkers. Using the annotation with no arguments, as in@UnannotatedFor({}), has no effect.- Returns:
- the type systems for which the annotated element has not been annotated
- See the Checker Framework Manual:
- Short names for built-in checkers
-
applyToSubpackages
boolean applyToSubpackagesWhen used on a package, whether this annotation should also apply to subpackages.- Returns:
- whether this annotation should be inherited by subpackages
- Default:
true
-