Annotation Type NegativeIndexFor
-
@Documented @Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER}) @SubtypeOf(SearchIndexFor.class) public @interface NegativeIndexFor
The annotated expression is between-1and-a.length - 1, inclusive, for each sequencealisted 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") }
-
-
Element Detail
-
value
@JavaExpression String[] value
Sequences for which this value is a "negative index"; that is, the expression is in the range-1to-a.length - 1, inclusive, for each sequenceagiven here.
-
-