Top Description Methods
org.checkerframework.framework.qual

public @Interface HasQualifierParameter

extends Annotation
Annotations
@Inherited
@Documented
@Retention:RUNTIME
@Target:TYPE, PACKAGE
Imports
java.lang.annotation.Annotation, .Documented, .ElementType, .Inherited, .Retention, .RetentionPolicy, .Target

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. Writing HasQualifierParameter on a package is the same as writing it on each class in that package.

Writing @HasQualifierParameter on a type declaration has two effects.

  1. Invariant subtyping is used for occurrences of the type: no two occurrences of the type with different qualifiers have a subtyping relationship.
  2. 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.
Here is an example of the effect of invariant subtyping. Suppose we have the following declaration:
 @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 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 as NoQualifierParameter for the same hierarchy.

See Also
NoQualifierParameter

Method Summary

Modifier and TypeMethod and Description
public Class<? extends Annotation>[]

Returns:

the value
value
()

Class of the top qualifier for the hierarchy for which this class has a qualifier parameter.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public Class<? extends Annotation>[] value()

Class of the top qualifier for the hierarchy for which this class has a qualifier parameter.

Returns:Class<? extends Annotation>[]

the value