Annotation Type HasQualifierParameter
-
@Inherited @Documented @Retention(RUNTIME) @Target({TYPE,PACKAGE}) public @interface HasQualifierParameter
This 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. WritingHasQualifierParameter
on a package is the same as writing it on each class in that package.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 { ... }@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
MyStringBufferWhen a class is
@HasQualifierParameter
, all its subclasses are as well.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. 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 asNoQualifierParameter
for 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>[]
value
Class of the top qualifier for the hierarchy for which this class has a qualifier parameter.
-