@Documented @Retention(value=RUNTIME) @Target(value={TYPE_USE,TYPE_PARAMETER}) @SubtypeOf(value=SearchIndexFor.class) public @interface NegativeIndexFor
-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") }
@JavaExpression public abstract String[] value
-1
to -a.length - 1
, inclusive, for each sequence a
given here.