Top Description Methods
org.checkerframework.checker.index.qual

public @Interface IndexFor

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:TYPE_USE, TYPE_PARAMETER
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target

An integer that can be used to index any of the given sequences.

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.

See Also
NonNegative, LTLengthOf

Method Summary

Modifier and TypeMethod and Description
public String[]
value()

Sequences that the annotated expression is a valid index for.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public String[] value()

Sequences that the annotated expression is a valid index for.