Annotation Interface HoldsForDefaultValue


@Documented @Retention(RUNTIME) @Target(ANNOTATION_TYPE) public @interface HoldsForDefaultValue
A meta-annotation that indicates that the qualifier can be applied to the default value of every relevant Java type (as per RelevantJavaTypes). It is used by the Initialization Checker to know which fields that are not initialized can still be considered initialized.

This meta-annotation should not be applied to the top qualifier in a hierarchy, as the top qualifier must always respect this property by default. It should also not be applied to monotonic or polymorphic qualifiers.

For example, the default value of every class-typed variable is null. Thus, in a nullness types system, Nullable holds for default values (but should not be annotated with this meta-annotation, since it is the top qualifier), but NonNull does not. For another example, the default value for numerical primitive types is 0. Thus, in a type system with qualifiers Even, Odd, and Unknown, the top qualifier Unknown holds for default values (but should not be annotated with this meta-annotation), Even holds for default values and should be annotated, and Odd does not hold for default values and should not be annotated.

Unannotated qualifiers are treated conservatively. Therefore, HoldsForDefaultValues annotations can be added to qualifiers once the Initialization Checker is used by a type system to suppress false positive warnings.

This is a trusted meta-annotation, meaning that it is not checked whether a qualifier actually holds for the default value.