Top Description Methods
org.checkerframework.framework.qual

public @Interface FieldInvariant

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:TYPE
@Inherited
Imports
java.lang.annotation.Annotation, .Documented, .ElementType, .Inherited, .Retention, .RetentionPolicy, .Target

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 @FieldInvariant annotation does not currently accommodate type qualifiers with attributes, such as @MinLen(1). In this case, the type system should implement its own field invariant annotation and override AnnotatedTypeFactory.getFieldInvariantDeclarationAnnotations() and AnnotatedTypeFactory.getFieldInvariants(). See org.checkerframework.common.value.qual.MinLenFieldInvariant for an example.

Method Summary

Modifier and TypeMethod and Description
public String[]
field()

The field that has a more precise type, in the class on which the FieldInvariant annotation is written.

public Class<? extends Annotation>[]
qualifier()

The qualifier on the field.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

fieldback to summary
public String[] field()

The field that has a more precise type, in the class on which the FieldInvariant annotation is written. The field must be declared in a superclass and must be final.

qualifierback to summary
public Class<? extends Annotation>[] qualifier()

The qualifier on the field. Must be a subtype of the qualifier on the declaration of the field.