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

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

Go to download

The Checker Framework enhances Java's type system to make it more powerful and useful. This lets software developers detect and prevent errors in their Java programs. The Checker Framework includes compiler plug-ins ("checkers") that find bugs or verify their absence. It also permits you to write your own compiler plug-ins.

There is a newer version: 3.0.0-b2
Show newest version
package org.checkerframework.common.value.qual;

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 */ @SubtypeOf(UnknownVal.class) @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) 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