@Documented @Retention(value=RUNTIME) @Target(value=FIELD) public @interface HasSubsequence
Consider the following example:
class IntSubArray {
@HasSubsequence(subsequence = "this", from = "this.start", to = "this.end")
int [] array;
@IndexFor("array") int start;
@IndexOrHigh("array") int end;
}
The above annotations mean that the value of an IntSubArray object is equal to a
subsequence of its array field.
These annotations imply the following relationships among @IndexFor
annotations:
i is @IndexFor("this"), then start + i is
@IndexFor("array").
j is @IndexFor("array"), then j - start is
@IndexFor("this").
a to array, 4 facts need to be true:
start is @NonNegative.
end is @LTEqLengthOf("a").
start is @LessThan("end + 1").
this equals array[start..end-1]
subsequence field is
equal to the given subsequence and then suppress the warning.
For an example of how this annotation is used in practice, see the test GuavaPrimitives.java in /checker/tests/index/.
This annotation may only be written on fields.
@JavaExpression public abstract String subsequence
@JavaExpression public abstract String from
@JavaExpression public abstract String to