1 package checkers.quals; 2 3 import java.lang.annotation.Documented; 4 import static java.lang.annotation.ElementType.*; 5 import java.lang.annotation.Retention; 6 import java.lang.annotation.RetentionPolicy; 7 import java.lang.annotation.Target; 8 9 /** 10 * Applied to a declaration of a package, type, method, variable, etc., 11 * specifies that the given annotation should be the default. The default is 12 * applied to all types within the declaration for which no other 13 * annotation is explicitly written. 14 * If multiple DefaultQualifier annotations are in scope, the innermost one 15 * takes precedence. 16 * DefaultQualifier takes precedence over {@link DefaultQualifierInHierarchy}. 17 * <p> 18 * 19 * If you wish to write multiple @DefaultQualifier annotations (for 20 * unrelated type systems, or with different {@code locations} fields) at 21 * the same location, use {@link DefaultQualifiers}. 22 * 23 * @see DefaultLocation 24 */ 25 @Documented 26 @Retention(RetentionPolicy.RUNTIME) 27 @Target({CONSTRUCTOR, METHOD, FIELD, LOCAL_VARIABLE, PARAMETER, TYPE}) 28 public @interface DefaultQualifier { 29 30 /** 31 * The name of the default annotation. It may be a short name like 32 * "NonNull", if an appropriate import statement exists. Otherwise, it 33 * should be fully-qualified, like "checkers.nullness.quals.NonNull". 34 * <p> 35 * 36 * To prevent affecting other type systems, always specify an annotation 37 * in your own type hierarchy. (For example, do not set 38 * "checkers.quals.Unqualified" as the default.) 39 */ 40 String value(); 41 42 /** @return the locations to which the annotation should be applied */ 43 DefaultLocation[] locations() default {DefaultLocation.ALL}; 44 } 45