checkers.quals.Dependent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checker-quals-jdk5 Show documentation
Show all versions of checker-quals-jdk5 Show documentation
Annotations ("type qualifiers") from the checker framework,
backported so they can be used in pre-JDK8 applications
package checkers.quals;
import java.lang.annotation.*;
/**
* Refines the qualified type of the annotated field or variable based on the
* qualified type of the receiver. The annotation declares a relationship
* between multiple type qualifier hierarchies.
*
* Example:
* Consider a field, {@code lock}, that is only initialized if the
* enclosing object (the receiver), is marked as {@code ThreadSafe}.
* Such a field can be declared as:
*
*
* private @Nullable @Dependent(result=NonNull.class, when=ThreadSafe.class)
* Lock lock;
*
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface Dependent {
/**
* The class of the refined qualifier to be applied.
*/
Class extends Annotation> result();
/**
* The qualifier class of the receiver that causes the {@code result}
* qualifier to be applied.
*/
Class extends Annotation> when();
}