private static boolean hasDirectEndEdge(Statement stat, Statement from) {

    for (StatEdge edge : stat.getAllSuccessorEdges()) {
      if (MergeHelper.isDirectPath(from, edge.getDestination())) {
        return true;
      }
    }

    if (stat.getExprents() == null) {
      switch (stat.type) {
        case SEQUENCE -> {
          return hasDirectEndEdge(stat.getStats().getLast(), from);
        }
        case CATCH_ALL, TRY_CATCH -> {
          for (Statement st : stat.getStats()) {
            if (hasDirectEndEdge(st, from)) {
              return true;
            }
          }
        }
        case IF -> {
          IfStatement ifstat = (IfStatement)stat;
          if (ifstat.iftype == IfStatement.IFTYPE_IFELSE) {
            return hasDirectEndEdge(ifstat.getIfstat(), from) ||
                   hasDirectEndEdge(ifstat.getElsestat(), from);
          }
        }
        case SYNCHRONIZED -> {
          return hasDirectEndEdge(stat.getStats().get(1), from);
        }
        case SWITCH -> {
          for (Statement st : stat.getStats()) {
            if (hasDirectEndEdge(st, from)) {
              return true;
            }
          }
        }
      }
    }

    return false;
  }
private static boolean hasDirectEndEdge(Statement stat, Statement from)