Annotation Interface PreservesModifiability
For example, if the first argument has a positive modifiability capability, such as
@Growable, @SeqGrowable, @Shrinkable, or @Replaceable, then the
return type has that same capability. If the first argument is @IteratorPolyMod, then the
return type is also @IteratorPolyMod. If the first argument has any other qualifier in a
capability hierarchy, then the return type is the top qualifier in that hierarchy.
It is an error to write this annotation on a method that does not have exactly one formal parameter, which is not a varargs parameter, and a non-void result, because the annotation relates the result to the first argument. (In a call to a varargs method, the first argument is an element of the varargs array rather than the sole formal parameter.) If such a method is nonetheless annotated -- in an annotation file, say, which is not checked -- then the annotation has no effect on it.
- See the Checker Framework Manual:
- Modifiability Checker