Annotation Type HasSubsequence
-
@Documented @Retention(RUNTIME) @Target(FIELD) public @interface HasSubsequenceThe annotated sequence contains a subsequence that is equal to the value of some other expression. This annotation permits the Upper Bound Checker to translate indices for one sequence into indices for the other sequence.Consider the following example:
The above annotations mean that the value of anclass IntSubArray { @HasSubsequence(subsequence = "this", from = "this.start", to = "this.end") int [] array; @IndexFor("array") int start; @IndexOrHigh("array") int end; }IntSubArrayobject is equal to a subsequence of itsarrayfield.These annotations imply the following relationships among
@IndexForannotations:- If
iis@IndexFor("this"), thenthis.start + iis@IndexFor("array"). - If
jis@IndexFor("array"), thenj - this.startis@IndexFor("this").
atoarray, 4 facts need to be true:startis@NonNegative.endis@LTEqLengthOf("a").startis@LessThan("end + 1").- the value of
thisequalsarray[start..end-1]
subsequencefield 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.
- See the Checker Framework Manual:
- Index Checker
- If
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.StringfromThe index into this where the subsequence starts.java.lang.StringsubsequenceAn expression that evaluates to the subsequence.java.lang.StringtoThe index into this, immediately past where the subsequence ends.
-
-
-
Element Detail
-
subsequence
@JavaExpression java.lang.String subsequence
An expression that evaluates to the subsequence.
-
-
-
from
@JavaExpression java.lang.String from
The index into this where the subsequence starts.
-
-
-
to
@JavaExpression java.lang.String to
The index into this, immediately past where the subsequence ends.
-
-