@Documented @Retention(value=RUNTIME) @Target(value={TYPE_USE,TYPE_PARAMETER}) public @interface IndexFor
For example, an expression with type @IndexFor({"a", "b"})
is non-negative and is less
than both a.length
and b.length
. The sequences a
and b
might have
different lengths.
The
String.charAt(int)
method is declared as
class String {
char charAt(@IndexFor("this") index) { ... }
}
Writing @IndexFor("arr")
is equivalent to writing @NonNegative
@LTLengthOf("arr")
, and that is how it is treated internally by the checker.
Thus, if you write an @IndexFor("arr")
annotation, you might see warnings about
@NonNegative
or @LTLengthOf
.
NonNegative
,
LTLengthOf
public abstract String[] value