Annotation Type HasQualifierParameter
-
@Inherited @Documented @Retention(RUNTIME) @Target({TYPE,PACKAGE}) public @interface HasQualifierParameterThis is a declaration annotation that applies to type declarations and packages. On a type, it means that the class conceptually takes a type qualifier parameter, though there is nowhere to write it because the class hard-codes a Java basetype rather than taking a type parameter. WritingHasQualifierParameteron a package is the same as writing it on each class in that package.Writing
@HasQualifierParameteron 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.
Then@HasQualifierParameterclass StringBuffer { ... }@Tainted StringBufferis unrelated to@Untainted StringBuffer.The type hierarchy looks like this:
@TaintedObject / | \ / |@TaintedDate / | | / | | /@UntaintedObject | / | \ |@TaintedStringBuffer |@UntaintedDate | | |@UntaintedStringBuffer | |@TaintedMyStringBuffer | |@UntaintedMyStringBufferWhen a class is
@HasQualifierParameter, all its subclasses are as well.When
@HasQualifierParameteris written on a package, it is equivalent to writing that annotation on each class in the package or in a sub-package. It can be disabled on a specific class and its subclasses by writing@NoQualifierParameteron that class. This annotation may not be written on the same class asNoQualifierParameterfor the same hierarchy.- See Also:
NoQualifierParameter
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.Class<? extends java.lang.annotation.Annotation>[]valueClass of the top qualifier for the hierarchy for which this class has a qualifier parameter.
-