Class LowerBoundAnnotatedTypeFactory

All Implemented Interfaces:
AnnotationProvider

public class LowerBoundAnnotatedTypeFactory extends BaseAnnotatedTypeFactoryForIndexChecker
Implements the introduction rules for the Lower Bound Checker.
  The type hierarchy is:

  Top = lbu ("Lower Bound Unknown")
   |
  gte-1 ("Greater than or equal to -1")
   |
  nn  ("NonNegative")
   |
  pos ("Positive")
  
In general, check whether the constant Value Checker can determine the value of a variable; if it can, use that; if not, use more specific rules based on expression type. This class implements the following type rules:
  • 1. If the value checker type for any expression is ≥ 1, refine that expression's type to positive.
  • 2. If the value checker type for any expression is ≥ 0 and case 1 did not apply, then refine that expression's type to non-negative.
  • 3. If the value checker type for any expression is ≥ -1 and cases 1 and 2 did not apply, then refine that expression's type to GTEN1.
  • 4. A unary prefix decrement shifts the type "down" in the hierarchy (i.e. --i when i is non-negative implies that i will be GTEN1 afterwards). Should this be 3 rules?
  • 5. A unary prefix increment shifts the type "up" in the hierarchy (i.e. ++i when i is non-negative implies that i will be positive afterwards). Should this be 3 rules?
  • 6. Unary negation on a NegativeIndexFor from the SearchIndex type system results in a non-negative.
  • 7. The result of a call to Math.max is the GLB of its arguments.
  • 8. If an array has a MinLen type ≥ 1 and its length is accessed, the length expression is positive.