Class LowerBoundVisitor

java.lang.Object
com.sun.source.util.TreeScanner<R,P>
com.sun.source.util.TreePathScanner<R,P>
All Implemented Interfaces:
com.sun.source.tree.TreeVisitor<Void,Void>

public class LowerBoundVisitor extends BaseTypeVisitor<LowerBoundAnnotatedTypeFactory>
Implements the actual checks to make sure that array accesses aren't too low. Will issue a warning if a variable that can't be proved to be either "NonNegative" (i.e. ≥ 0) or "Positive" (i.e. ≥ 1) is used as an array index.
  • Constructor Details

  • Method Details

    • visitArrayAccess

      public Void visitArrayAccess(com.sun.source.tree.ArrayAccessTree tree, Void type)
      Specified by:
      visitArrayAccess in interface com.sun.source.tree.TreeVisitor<Void,Void>
      Overrides:
      visitArrayAccess in class com.sun.source.util.TreeScanner<Void,Void>
    • visitNewArray

      public Void visitNewArray(com.sun.source.tree.NewArrayTree tree, Void type)
      Specified by:
      visitNewArray in interface com.sun.source.tree.TreeVisitor<Void,Void>
      Overrides:
      visitNewArray in class BaseTypeVisitor<LowerBoundAnnotatedTypeFactory>
    • commonAssignmentCheck

      protected void commonAssignmentCheck(com.sun.source.tree.Tree varTree, com.sun.source.tree.ExpressionTree valueTree, @CompilerMessageKey String errorKey, Object... extraArgs)
      Description copied from class: BaseTypeVisitor
      Checks the validity of an assignment (or pseudo-assignment) from a value to a variable and emits an error message (through the compiler's messaging interface) if it is not valid.
      Overrides:
      commonAssignmentCheck in class BaseTypeVisitor<LowerBoundAnnotatedTypeFactory>
      Parameters:
      varTree - the AST node for the lvalue (usually a variable)
      valueTree - the AST node for the rvalue (the new value)
      errorKey - the error message key to use if the check fails
      extraArgs - arguments to the error message key, before "found" and "expected" types