jif.visit
Class ArrayIndexChecker

java.lang.Object
  extended by polyglot.visit.NodeVisitor
      extended by polyglot.visit.HaltingVisitor
          extended by polyglot.visit.ErrorHandlingVisitor
              extended by polyglot.visit.DataFlow
                  extended by jif.visit.ArrayIndexChecker
All Implemented Interfaces:
java.lang.Cloneable, polyglot.util.Copy

public class ArrayIndexChecker
extends polyglot.visit.DataFlow

###TODO


Nested Class Summary
 
Nested classes/interfaces inherited from class polyglot.visit.DataFlow
polyglot.visit.DataFlow.BoolItem, polyglot.visit.DataFlow.ConditionNavigator, polyglot.visit.DataFlow.FlowGraphSource, polyglot.visit.DataFlow.Item
 
Field Summary
 
Fields inherited from class polyglot.visit.DataFlow
dataflowOnEntry, flowCounter, flowgraphStack, forward
 
Fields inherited from class polyglot.visit.ErrorHandlingVisitor
error, job, nf, ts
 
Constructor Summary
ArrayIndexChecker(polyglot.frontend.Job job, polyglot.types.TypeSystem ts, polyglot.ast.NodeFactory nf)
          Constructor
 
Method Summary
protected  void check(polyglot.visit.FlowGraph graph, polyglot.ast.Term n, polyglot.visit.DataFlow.Item inItem, java.util.Map outItems)
          For each array access, determine if the array access could throw an ArrayIndexOutOfBoundsException, and annotate the node appropriately.
protected  polyglot.visit.DataFlow.Item confluence(java.util.List items, polyglot.ast.Term node, polyglot.visit.FlowGraph graph)
          The confluence operator is essentially intersection: a bound must be in all DataFlowItems going into the confluence for it to be valid.
protected  polyglot.visit.DataFlow.Item createInitialItem(polyglot.visit.FlowGraph graph, polyglot.ast.Term node)
          Create an initial Item for the dataflow analysis.
 java.util.Map flow(polyglot.visit.DataFlow.Item in, polyglot.visit.FlowGraph graph, polyglot.ast.Term n, java.util.Set succEdgeKeys)
          Implement the flow equations for this dataflow analysis.
 
Methods inherited from class polyglot.visit.DataFlow
confluence, constructItemsFromCondition, createCFGBuilder, currentFlowGraph, dataflow, dataflow, dumpFlowGraph, enterCall, filterItems, filterItemsExceptionSubclass, filterItemsNonError, filterItemsNonException, findSCCs, flow, flow, flowBooleanConditions, flowToBooleanFlow, hasTrueFalseBranches, initGraph, itemsToMap, itemToMap, leave, leaveCall, post, safeConfluence, safeConfluence, safeConfluence
 
Methods inherited from class polyglot.visit.ErrorHandlingVisitor
begin, catchErrors, enter, enterCall, enterError, errorQueue, hasErrors, job, leaveCall, leaveCall, nodeFactory, typeSystem
 
Methods inherited from class polyglot.visit.HaltingVisitor
bypass, bypass, bypassChildren, override, visitChildren
 
Methods inherited from class polyglot.visit.NodeVisitor
copy, enter, finish, finish, leave, override, toString, visitEdge, visitEdgeNoOverride
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayIndexChecker

public ArrayIndexChecker(polyglot.frontend.Job job,
                         polyglot.types.TypeSystem ts,
                         polyglot.ast.NodeFactory nf)
Constructor

Method Detail

createInitialItem

protected polyglot.visit.DataFlow.Item createInitialItem(polyglot.visit.FlowGraph graph,
                                                         polyglot.ast.Term node)
Create an initial Item for the dataflow analysis. By default, the map of integer bounds is empty.

Specified by:
createInitialItem in class polyglot.visit.DataFlow

flow

public java.util.Map flow(polyglot.visit.DataFlow.Item in,
                          polyglot.visit.FlowGraph graph,
                          polyglot.ast.Term n,
                          java.util.Set succEdgeKeys)
Implement the flow equations for this dataflow analysis.

Overrides:
flow in class polyglot.visit.DataFlow

confluence

protected polyglot.visit.DataFlow.Item confluence(java.util.List items,
                                                  polyglot.ast.Term node,
                                                  polyglot.visit.FlowGraph graph)
The confluence operator is essentially intersection: a bound must be in all DataFlowItems going into the confluence for it to be valid.

Specified by:
confluence in class polyglot.visit.DataFlow

check

protected void check(polyglot.visit.FlowGraph graph,
                     polyglot.ast.Term n,
                     polyglot.visit.DataFlow.Item inItem,
                     java.util.Map outItems)
              throws polyglot.types.SemanticException
For each array access, determine if the array access could throw an ArrayIndexOutOfBoundsException, and annotate the node appropriately.

Specified by:
check in class polyglot.visit.DataFlow
Throws:
polyglot.types.SemanticException