Annotation Interface HasQualifierParameter
HasQualifierParameter on a package is the same as writing it on
each class in that package.
Written on a type declaration
Writing @HasQualifierParameter on a type declaration has two effects.
- Invariant subtyping is used for occurrences of the type: no two occurrences of the type with different qualifiers have a subtyping relationship.
- The polymorphic qualifier is the default for all occurrences of that type in its own compilation unit, including as the receiver, as another formal parameter, or as a return type.
@HasQualifierParameter
class StringBuffer { ... }
Then @Tainted StringBuffer is unrelated to @Untainted StringBuffer.
The type hierarchy looks like this:
@Tainted Object
/ | \
/ | @Tainted Date
/ | |
/ | |
/ @Untainted Object |
/ | \ |
@Tainted StringBuffer | @Untainted Date
| |
| @Untainted StringBuffer
| |
@Tainted MyStringBuffer |
|
@Untainted MyStringBuffer
When a type is @HasQualifierParameter, all its subtypes are as well. That is, the
@HasQualifierParameter annotation is inherited by subtypes.
Written on a package
When @HasQualifierParameter is written on a package, it is equivalent to writing that
annotation on each class in the package or in a sub-package. Set the applyToSubpackages
field to false to limit it to the package itself; doing so does not block an applicable
@HasQualifierParameter on an enclosing package. It can be disabled on a specific class
and its subclasses by writing @NoQualifierParameter on that class. This annotation may
not be written on the same class as @NoQualifierParameter for the same hierarchy.
- See Also:
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionClass<? extends Annotation>[]Class of the top qualifier for the hierarchy for which this class has a qualifier parameter. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhen used on a package, whether this annotation should also apply to subpackages.
-
Element Details
-
value
Class<? extends Annotation>[] valueClass of the top qualifier for the hierarchy for which this class has a qualifier parameter.- Returns:
- the value
-
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
-