All Downloads are FREE. Search and download functionalities are using the official Maven repository.

checker.src.org.checkerframework.checker.nullness.qual.Covariant Maven / Gradle / Ivy

Go to download

The Checker Framework enhances Java’s type system to make it more powerful and useful. This lets software developers detect and prevent errors in their Java programs. The Checker Framework includes compiler plug-ins ("checkers") that find bugs or verify their absence. It also permits you to write your own compiler plug-ins.

There is a newer version: 3.42.0
Show newest version
package org.checkerframework.checker.nullness.qual;

import java.lang.annotation.*;

// TODO: move to org.checkerframework.framework.qual package.
/**
 * A marker annotation, written on a class declaration, that signifies that
 * one or more of the class's type parameters can be treated covariantly.
 * For example, if MyClass has a single type parameter that is
 * treated covariantly, and if B is a subtype of A, then
 * SomeClass<B> is a subtype of SomeClass<B>.
 * 

* * Ordinarily, Java treats type parameters invariantly: * SomeClass<B> is unrelated to (neither a subtype nor a * supertype of) SomeClass<A>. *

* * It is only safe to mark a type parameter as covariant if the type * parameter is used in a read-only way: values of that type are read from * but never modified. This property is not checked; the * @Covariant is simply trusted. *

* * @checker_framework.manual #covariant-type-parameters Covariant type parameters */ @Documented @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Covariant { /** * The zero-based indices of the type parameters that should be treated * covariantly. */ int[] value(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy