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

public @Interface EnsuresLTLengthOf

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:METHOD, CONSTRUCTOR
@PostconditionAnnotation
qualifier:LTLengthOf
@InheritedAnnotation
@Repeatable:List
Imports
java.lang.annotation.Documented, .ElementType, .Repeatable, .Retention, .RetentionPolicy, .Target, org.checkerframework.framework.qual.InheritedAnnotation, .JavaExpression, .PostconditionAnnotation, .QualifierArgument

Indicates that the value expressions evaluate to an integer whose value is less than the lengths of all the given sequences, if the method terminates successfully.

Consider the following example, from the Index Checker's regression tests:

@EnsuresLTLengthOf(value = "end", targetValue = "array", offset = "#1 - 1")
 public void shiftIndex(@NonNegative int x) {
     int newEnd = end - x;
     if (newEnd < 0) throw new RuntimeException();
     end = newEnd;
 }

where end is annotated as @NonNegative @LTEqLengthOf("array") int end;

This method guarantees that end has type @LTLengthOf(value="array", offset="x - 1") after the method returns. This is useful in cases like this one:

public void useShiftIndex(@NonNegative int x) {
   // :: error: (argument)
   Arrays.fill(array, end, end + x, null);
   shiftIndex(x);
   Arrays.fill(array, end, end + x, null);
}
The first call to Arrays.fill is rejected (hence the comment about an error). But, after calling shiftIndex(x), end has an annotation that allows the end + x to be accepted as @LTLengthOf("array").
See Also
EnsuresLTLengthOfIf, LTLengthOf

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static @interface
EnsuresLTLengthOf.List

A wrapper annotation that makes the EnsuresLTLengthOf annotation repeatable.

Method Summary

Modifier and TypeMethod and Description
public String[]

Returns:

the offset expressions
offset
()

This expression plus each of the value expressions is less than the length of the sequence on successful method termination.

public String[]
targetValue()

Sequences, each of which is longer than the each of the expressions' value on successful method termination.

public String[]
value()

The Java expressions that are less than the length of the given sequences on successful method termination.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

offsetback to summary
public String[] offset()

This expression plus each of the value expressions is less than the length of the sequence on successful method termination. The offset element must ether be empty or the same length as targetValue.

Returns:String[]

the offset expressions

Annotations
@JavaExpression
@QualifierArgument:offset
targetValueback to summary
public String[] targetValue()

Sequences, each of which is longer than the each of the expressions' value on successful method termination.

Annotations
@JavaExpression
@QualifierArgument:value
valueback to summary
public String[] value()

The Java expressions that are less than the length of the given sequences on successful method termination.

Annotations
@JavaExpression
org.checkerframework.checker.index.qual back to summary

public @Interface EnsuresLTLengthOf.List

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:METHOD, CONSTRUCTOR
@PostconditionAnnotation
qualifier:LTLengthOf
@InheritedAnnotation

A wrapper annotation that makes the EnsuresLTLengthOf annotation repeatable.

Programmers generally do not need to write this. It is created by Java when a programmer writes more than one EnsuresLTLengthOf annotation at the same location.

Method Summary

Modifier and TypeMethod and Description
public EnsuresLTLengthOf[]

Returns:

the repeatable annotations
value
()

Return the repeatable annotations.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public EnsuresLTLengthOf[] value()

Return the repeatable annotations.

Returns:EnsuresLTLengthOf[]

the repeatable annotations