private static BlockNode traverseMonitorExitsCross(BlockNode block,Set<BlockNode> exits,Set<BlockNode> visited){
  visited.add(block);
  for (  BlockNode node : block.getCleanSuccessors()) {
    boolean cross=true;
    for (    BlockNode exitBlock : exits) {
      boolean p=isPathExists(exitBlock,node);
      if (!p) {
        cross=false;
        break;
      }
    }
    if (cross) {
      return node;
    }
    if (!visited.contains(node)) {
      BlockNode res=traverseMonitorExitsCross(node,exits,visited);
      if (res != null) {
        return res;
      }
    }
  }
  return null;
}

private static BlockNode traverseMonitorExitsCross ( BlockNode block , Set < BlockNode > exits , Set < BlockNode > visited ) { visited . add ( block ) ; for ( BlockNode node : block . getCleanSuccessors ( ) ) { boolean cross = true ; for ( BlockNode exitBlock : exits ) { boolean p = isPathExists ( exitBlock , node ) ; if ( ! p ) { cross = false ; break ; } } if ( cross ) { return node ; } if ( ! visited . contains ( node ) ) { BlockNode res = traverseMonitorExitsCross ( node , exits , visited ) ; if ( res != null ) { return res ; } } } return null ; }
traverse from monitor - enter thru successors and search for exit paths cross
