@SubstringIndexFor(args) is like
@NonNegative @LTLengthOf(args), except that
@SubstringIndexFor(args) additionally permits the value -1.
When multiple values or offsets are given, they are considered pairwise. For example,
@SubstringIndexFor(value={"a", "b"}, offset={"c", "d"}) is equivalent to writing both
@SubstringIndexFor(value="a", offset="c") and @SubstringIndexFor(value="b",
offset="d").
The return types of JDK methods String.indexOf and
String.lastIndexOf are annotated
@SubstringIndexFor(value="this",offset="#1.length()-1"). This means that the returned
value is either -1 or it is less than or equal to the length of the receiver sequence minus the
length of the sequence passed as the first argument.
The name of this annotation, "substring index for", is intended to mean that the annotated
expression is a index of a substring (returned by indexOf or similar methods) for the
specified sequence.
| Modifier and Type | Method and Description |
|---|---|
| public String[] | offset()
This expression plus the annotated expression is less than the length of the corresponding
sequence in the |
| public String[] | value()
Sequences, each of which is longer than the annotated expression plus the corresponding |
| offset | back to summary |
|---|---|
| public String[] offset() This expression plus the annotated expression is less than the length of the corresponding
sequence in the The The expressions in
| |
| value | back to summary |
|---|---|
| public String[] value() Sequences, each of which is longer than the annotated expression plus the corresponding
| |