@Documented @Target(value=TYPE) @Retention(value=RUNTIME) public @interface Covariant
MyClasshas a single type parameter that is treated covariantly, and if
Bis a subtype of
SomeClass<B>is a subtype of
Ordinarily, Java treats type parameters invariantly:
SomeClass<B> is unrelated to
(neither a subtype nor a supertype of)
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
@Covariant is simply trusted.
|Modifier and Type||Required Element and Description|
The zero-based indices of the type parameters that should be treated covariantly.