Annotation Type MonotonicQualifier
-
@Documented @Retention(RUNTIME) @Target(ANNOTATION_TYPE) public @interface MonotonicQualifier
A meta-annotation that indicates that a qualifier indicates that an expression goes monotonically from a type qualifierT
to another qualifierS
. The annotationS
is called the target of the monotonic qualifier, and has to be indicated byvalue()
.This meta-annotation can be used on the declaration of the monotonic qualifier used for the type-system at hand, and is often called
MonoT
if the target isT
. The subtyping hierarchy has to be defined as follows:
whereT <: MonoT <: S
<:
indicates the subtyping relation.An expression of a monotonic type can only be assigned expressions of the target type
T
. This means that an expression of the monotonic typeMonoT
cannot be assigned to a variable of the same type.Reading an expression of a monotonic type
MonoT
might always yield an expression of typeS
. However, once it has been observed that a variable has the target typeT
, the monotonic property ensures that it will stay of typeT
for the rest of the program execution. This is even true if arbitrary other code is executed.Note that variables of a monotonic type can be re-assigned arbitrarily often, but only with expressions of the target type.
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.Class<? extends java.lang.annotation.Annotation>
value
-