@Documented
@Retention(value=RUNTIME)
@Target(value=ANNOTATION_TYPE)
public @interface TargetLocations
@Target({ElementType.TYPE_USE})
, the given type qualifier may
be written only at locations listed in the @TargetLocations(...)
meta-annotation.
@Target({ElementType.TYPE_USE})
together with no @TargetLocations(...)
means that
the qualifier can be written on any type use.
This enables a type system designer to permit a qualifier to be written only in certain
locations. For example, some type systems' top and bottom qualifier (such as KeyForBottom
) should only be written on an explicit
wildcard upper or lower bound. This meta-annotation is a declarative, coarse-grained approach to
enable that. A TypeValidator
must be implemented if
finer-grained control is necessary.
Modifier and Type | Required Element and Description |
---|---|
TypeUseLocation[] |
value
Type uses at which the qualifier is permitted to be written in source code.
|
public abstract TypeUseLocation[] value