jif.visit

## Class PreciseClassChecker

- java.lang.Object
- - polyglot.visit.NodeVisitor
  - - polyglot.visit.HaltingVisitor
    - - polyglot.visit.ErrorHandlingVisitor
      - - polyglot.visit.DataFlow<jif.visit.PreciseClassChecker.DataFlowItem>
        - - jif.visit.PreciseClassChecker

- All Implemented Interfaces:
    java.lang.Cloneable, polyglot.util.Copy<polyglot.visit.NodeVisitor>

      public class PreciseClassChecker
      extends polyglot.visit.DataFlow<jif.visit.PreciseClassChecker.DataFlowItem>

  Visitor which determines at which program points more precise information is known about the runtime class of local variables and final access paths. This information is then stored in the appropriate delegates.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class polyglot.visit.DataFlow

      `polyglot.visit.DataFlow.BoolItem<FlowItem extends polyglot.visit.DataFlow.Item>, polyglot.visit.DataFlow.ConditionNavigator<FlowItem extends polyglot.visit.DataFlow.Item>, polyglot.visit.DataFlow.FlowGraphSource<FlowItem extends polyglot.visit.DataFlow.Item>, polyglot.visit.DataFlow.Frame<FlowItem extends polyglot.visit.DataFlow.Item>, polyglot.visit.DataFlow.Item`

    - ### Nested classes/interfaces inherited from interface polyglot.util.Copy

      `polyglot.util.Copy.Util`

  - ### Field Summary

    - ### Fields inherited from class polyglot.visit.DataFlow

      `dataflowOnEntry, detectBackEdges, flowCounter, flowgraphStack, forward, postordering`

    - ### Fields inherited from class polyglot.visit.ErrorHandlingVisitor

      `error, job, nf, ts`

    - ### Fields inherited from class polyglot.visit.HaltingVisitor

      `bypass, bypassParent`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PreciseClassChecker(polyglot.frontend.Job job)`
    `PreciseClassChecker(polyglot.frontend.Job job, polyglot.types.TypeSystem ts, polyglot.ast.NodeFactory nf)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `polyglot.visit.NodeVisitor` | `begin()`
    `protected void` | `check(polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph, polyglot.ast.Term n, boolean entry, jif.visit.PreciseClassChecker.DataFlowItem inItem, java.util.Map<polyglot.visit.FlowGraph.EdgeKey,jif.visit.PreciseClassChecker.DataFlowItem> outItems)` "Check" the nodes of the graph for the precise class analysis.
    `protected jif.visit.PreciseClassChecker.DataFlowItem` | `confluence(java.util.List<jif.visit.PreciseClassChecker.DataFlowItem> items, polyglot.visit.FlowGraph.Peer<jif.visit.PreciseClassChecker.DataFlowItem> peer, polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph)` The confluence operator is intersection: a variable is not null only if it is not null on all paths flowing in.
    `protected jif.visit.PreciseClassChecker.DataFlowItem` | `createInitialItem(polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph, polyglot.ast.Term node, boolean entry)` Create an initial Item for the dataflow analysis.
    `jif.visit.PreciseClassChecker.DataFlowItem` | `createItem(polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph, polyglot.ast.Term n)`
    `protected java.util.Map<polyglot.visit.FlowGraph.EdgeKey,jif.visit.PreciseClassChecker.DataFlowItem>` | `flow(java.util.List<jif.visit.PreciseClassChecker.DataFlowItem> inItems, java.util.List<polyglot.visit.FlowGraph.EdgeKey> inItemKeys, polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph, polyglot.visit.FlowGraph.Peer<jif.visit.PreciseClassChecker.DataFlowItem> peer)`
    `java.util.Map<polyglot.visit.FlowGraph.EdgeKey,jif.visit.PreciseClassChecker.DataFlowItem>` | `flow(jif.visit.PreciseClassChecker.DataFlowItem trueItem, jif.visit.PreciseClassChecker.DataFlowItem falseItem, jif.visit.PreciseClassChecker.DataFlowItem otherItem, polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph, polyglot.visit.FlowGraph.Peer<jif.visit.PreciseClassChecker.DataFlowItem> peer)` If a local variable is initialized with a non-null expression, then the variable is not null.

    - ### Methods inherited from class polyglot.visit.DataFlow

      `check, confluence, constructItemsFromCondition, createCFGBuilder, createFrame, createInitialItem, currentFlowGraph, dataflow, dataflow, dataflow, dumpFlowGraph, enterCall, filterItems, filterItemsExceptionSubclass, filterItemsNonError, filterItemsNonException, findSCCs, flow, flow, flow, flowBooleanConditions, flowToBooleanFlow, hasTrueFalseBranches, initGraph, initGraph, itemsToMap, itemToMap, lang, leave, leaveCall, post, safeConfluence, safeConfluence, safeConfluence`

    - ### Methods inherited from class polyglot.visit.ErrorHandlingVisitor

      `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

    - #### PreciseClassChecker

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

    - #### PreciseClassChecker

          public PreciseClassChecker(polyglot.frontend.Job job)

  - ### Method Detail

    - #### begin

          public polyglot.visit.NodeVisitor begin()

      Overrides:
        `begin` in class `polyglot.visit.ErrorHandlingVisitor`

    - #### createItem

          public jif.visit.PreciseClassChecker.DataFlowItem createItem(polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph,
                                                                       polyglot.ast.Term n)

    - #### createInitialItem

          protected jif.visit.PreciseClassChecker.DataFlowItem createInitialItem(polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph,
                                                                                 polyglot.ast.Term node,
                                                                                 boolean entry)

      Create an initial Item for the dataflow analysis. By default, the set of not null variables is empty.
      Specified by:
        `createInitialItem` in class `polyglot.visit.DataFlow<jif.visit.PreciseClassChecker.DataFlowItem>`

    - #### flow

          protected java.util.Map<polyglot.visit.FlowGraph.EdgeKey,jif.visit.PreciseClassChecker.DataFlowItem> flow(java.util.List<jif.visit.PreciseClassChecker.DataFlowItem> inItems,
                                                                                                                    java.util.List<polyglot.visit.FlowGraph.EdgeKey> inItemKeys,
                                                                                                                    polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph,
                                                                                                                    polyglot.visit.FlowGraph.Peer<jif.visit.PreciseClassChecker.DataFlowItem> peer)

      Overrides:
        `flow` in class `polyglot.visit.DataFlow<jif.visit.PreciseClassChecker.DataFlowItem>`

    - #### flow

          public java.util.Map<polyglot.visit.FlowGraph.EdgeKey,jif.visit.PreciseClassChecker.DataFlowItem> flow(jif.visit.PreciseClassChecker.DataFlowItem trueItem,
                                                                                                                 jif.visit.PreciseClassChecker.DataFlowItem falseItem,
                                                                                                                 jif.visit.PreciseClassChecker.DataFlowItem otherItem,
                                                                                                                 polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph,
                                                                                                                 polyglot.visit.FlowGraph.Peer<jif.visit.PreciseClassChecker.DataFlowItem> peer)

      If a local variable is initialized with a non-null expression, then the variable is not null. If a local variable is assigned non-null expression then the variable is not null; if a local variable is assigned a possibly null expression, then the local variable is possibly null.
      Overrides:
        `flow` in class `polyglot.visit.DataFlow<jif.visit.PreciseClassChecker.DataFlowItem>`

    - #### confluence

          protected jif.visit.PreciseClassChecker.DataFlowItem confluence(java.util.List<jif.visit.PreciseClassChecker.DataFlowItem> items,
                                                                          polyglot.visit.FlowGraph.Peer<jif.visit.PreciseClassChecker.DataFlowItem> peer,
                                                                          polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph)

      The confluence operator is intersection: a variable is not null only if it is not null on all paths flowing in.
      Specified by:
        `confluence` in class `polyglot.visit.DataFlow<jif.visit.PreciseClassChecker.DataFlowItem>`

    - #### check

          protected void check(polyglot.visit.FlowGraph<jif.visit.PreciseClassChecker.DataFlowItem> graph,
                               polyglot.ast.Term n,
                               boolean entry,
                               jif.visit.PreciseClassChecker.DataFlowItem inItem,
                               java.util.Map<polyglot.visit.FlowGraph.EdgeKey,jif.visit.PreciseClassChecker.DataFlowItem> outItems)

      "Check" the nodes of the graph for the precise class analysis. This actually consists of setting the preciseClass field in the Jif extensions to nodes, so that their exceptionCheck methods can decide whether to suppress the ClassCastExceptions that they would otherwise declare would be thrown.
      Specified by:
        `check` in class `polyglot.visit.DataFlow<jif.visit.PreciseClassChecker.DataFlowItem>`