All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.checkerframework.checker.index.qual.NegativeIndexFor Maven / Gradle / Ivy

Go to download

Guava is a suite of core and expanded libraries that include utility classes, google's collections, io classes, and much much more.

There is a newer version: 62
Show newest version
package org.checkerframework.checker.index.qual;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.checkerframework.framework.qual.JavaExpression;
import org.checkerframework.framework.qual.SubtypeOf;

/**
 * The annotated expression is between {@code -1} and {@code -a.length - 1}, inclusive, for each
 * sequence {@code 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 * {@code 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")
 *     }
 * 
* * @checker_framework.manual #index-checker Index Checker */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @SubtypeOf(SearchIndexFor.class) public @interface NegativeIndexFor { /** * Sequences for which this value is a "negative index"; that is, the expression is in the range * {@code -1} to {@code -a.length - 1}, inclusive, for each sequence {@code a} given here. */ @JavaExpression public String[] value(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy