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

org.checkerframework.framework.qual.FieldInvariant 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.framework.qual;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.lang.model.element.TypeElement;

/**
 * Specifies that a field's type, in the class on which this annotation is written, is a subtype of
 * its declared type. The field must be declared in a superclass and must be final.
 *
 * 

The {@code @FieldInvariant} annotation does not currently accommodate type qualifiers with * attributes, such as {@code @MinLen(1)}. In this case, the type system should implement its own * field invariant annotation and override {@link * org.checkerframework.framework.type.AnnotatedTypeFactory#getFieldInvariantDeclarationAnnotations()} * and {@link * org.checkerframework.framework.type.AnnotatedTypeFactory#getFieldInvariants(TypeElement)}. See * {@link org.checkerframework.common.value.qual.MinLenFieldInvariant} for example. * * @checker_framework.manual #field-invariants Field invariants */ @Target({ElementType.TYPE}) @Inherited @Retention(RetentionPolicy.RUNTIME) public @interface FieldInvariant { /** * The qualifier on the field. Must be a subtype of the qualifier on the declaration of the * field. */ Class[] qualifier(); /** * The field that has a more precise type, in the class on which the {@code FieldInvariant} * annotation is written. The field must be declared in a superclass and must be {@code final}. */ String[] field(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy