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

public @Interface NegativeIndexFor

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:TYPE_USE, TYPE_PARAMETER
@SubtypeOf:SearchIndexFor
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target, org.checkerframework.framework.qual.JavaExpression, .SubtypeOf

The annotated expression is between -1 and -a.length - 1, inclusive, for each sequence a listed in the annotation.

This type should rarely (if ever) be written by programmers. It is inferred by the SearchIndexChecker when the result of a call to one of the JDK's binary search methods (like Arrays.binarySearch) is known to be less than zero. For example, consider the following code:


    int index = Arrays.binarySearch(array, target);
    if (index < 0) {
         // index's type here is @NegativeIndexFor("array")
         index = index * -1;
         // now index's type is @IndexFor("array")
    }

Method Summary

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

Sequences for which this value is a "negative index"; that is, the expression is in the range -1 to -a.length - 1, inclusive, for each sequence a given here.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public String[] value()

Sequences for which this value is a "negative index"; that is, the expression is in the range -1 to -a.length - 1, inclusive, for each sequence a given here.

Annotations
@JavaExpression