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

org.checkerframework.common.value.qual.IntRange Maven / Gradle / Ivy

package org.checkerframework.common.value.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.SubtypeOf;

/**
 * An expression with this type evaluates to an integral value (byte, short, char, int, or long) in
 * the given range. The bounds are inclusive. For example, the following declaration allows the 12
 * values 0, 1, ..., 11:
 *
 * 
{@code @IntRange(from=0, to=11) int month;}
* *

If only one of the {@code to} and {@code from} fields is set, then the other will default to * the max/min value of the type of the variable that is annotated. (In other words, the defaults * {@code Long.MIN_VALUE} and {@code Long.MAX_VALUE} are used only for \code{long}; appropriate * values are used for other types.) * * @checker_framework.manual #constant-value-checker Constant Value Checker */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) @SubtypeOf(UnknownVal.class) public @interface IntRange { /** Smallest value in the range, inclusive. */ long from() default Long.MIN_VALUE; /** Largest value in the range, inclusive. */ long to() default Long.MAX_VALUE; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy