Example #1
0
  /**
   * Add path to error traces
   *
   * @param errTraces List of CheckerErrorTraces to be filled with new error trace
   * @param path new error trace
   */
  private void addTrace(List<CheckerErrorTrace> errTraces, List<CFGNode> path) {
    List<CheckerErrorTraceLocation> trace = new ArrayList<CheckerErrorTraceLocation>();

    CFGHandle handle = dictionary.get(path.get(0));

    ListIterator<CFGNode> it = path.listIterator();
    for (; it.hasNext(); ) it.next();

    for (; it.hasPrevious(); ) {
      CFGNode node = it.previous();
      CheckerErrorTraceLocation traceNode =
          new CheckerErrorTraceLocation(
              Stanse.getUnitManager().getUnitName(handle),
              node.getLine(),
              node.getColumn(),
              node.getElement().asXML());
      trace.add(traceNode);
    }
    errTraces.add(new CheckerErrorTrace(trace, "trace " + (errTraces.size() + 1)));
  }