Class LowerBoundVisitor

  • All Implemented Interfaces:
    com.sun.source.tree.TreeVisitor<java.lang.Void,​java.lang.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 Detail

    • Method Detail

      • visitArrayAccess

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

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

        protected boolean commonAssignmentCheck​(com.sun.source.tree.Tree varTree,
                                                com.sun.source.tree.ExpressionTree valueTree,
                                                @CompilerMessageKey java.lang.String errorKey,
                                                java.lang.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
        Returns:
        true if the check succeeds, false if an error message was issued