Top Description Methods
org.checkerframework.checker.index.qual

public @Interface HasSubsequence

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:FIELD
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target, org.checkerframework.framework.qual.JavaExpression

The annotated sequence contains a subsequence that is equal to the value of some other expression. This annotation permits the Upper Bound Checker to translate indices for one sequence into indices for the other sequence.

Consider the following example:


 class IntSubArray {
   @HasSubsequence(subsequence = "this", from = "this.start", to = "this.end")
   int [] array;
   @IndexFor("array") int start;
   @IndexOrHigh("array") int end;
 }
The above annotations mean that the value of an IntSubArray object is equal to a subsequence of its array field.

These annotations imply the following relationships among @IndexFor annotations:

When assigning an array a to array, 4 facts need to be true: The Index Checker verifies the first 3 facts, but always issues a warning because it cannot prove the 4th fact. The programmer should manually verify that the subsequence field is equal to the given subsequence and then suppress the warning.

For an example of how this annotation is used in practice, see the test GuavaPrimitives.java in /checker/tests/index/.

This annotation may only be written on fields.

Method Summary

Modifier and TypeMethod and Description
public String
from()

The index into this where the subsequence starts.

public String
subsequence()

An expression that evaluates to the subsequence.

public String
to()

The index into this, immediately past where the subsequence ends.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

fromback to summary
public String from()

The index into this where the subsequence starts.

Annotations
@JavaExpression
subsequenceback to summary
public String subsequence()

An expression that evaluates to the subsequence.

Annotations
@JavaExpression
toback to summary
public String to()

The index into this, immediately past where the subsequence ends.

Annotations
@JavaExpression