@Documented @Retention(value=SOURCE) @Target(value={PACKAGE,TYPE,CONSTRUCTOR,METHOD,FIELD,LOCAL_VARIABLE,PARAMETER}) @Repeatable(value=DefaultQualifier.List.class) public @interface DefaultQualifier
DefaultQualifier annotations are in scope, the innermost one takes precedence.
DefaultQualifier takes precedence over DefaultQualifierInHierarchy.
You may write multiple @DefaultQualifier annotations (for unrelated type systems, or
with different locations fields) at the same location. For example:
@DefaultQualifier(NonNull.class)
@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.IMPLICIT_UPPER_BOUND)
@DefaultQualifier(Tainted.class)
class MyClass { ... }
Defaults on a package also apply to subpackages, unless the applyToSubpackages field
is set to false.
This annotation currently has no effect in stub files.
TypeUseLocation,
DefaultQualifierInHierarchy,
DefaultFor| Modifier and Type | Required Element and Description |
|---|---|
Class<? extends Annotation> |
value
The Class for the default annotation.
|
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
applyToSubpackages
When used on a package, whether the defaults should also apply to subpackages.
|
TypeUseLocation[] |
locations
Returns the locations to which the annotation should be applied.
|
public abstract Class<? extends Annotation> value
To prevent affecting other type systems, always specify an annotation in your own type
hierarchy. (For example, do not set Unqualified as the default.)
public abstract TypeUseLocation[] locations