if (parent == null) {
if (parent == null || node == parent) {
    private void resolveConflict(IvyNode node, IvyNode parent, Collection toevict) {        if (parent == null) {            return;        }        if (node.getId().equals(node.getResolvedId()) && parent.getResolvedRevisions(node.getModuleId(), node.getRootModuleConf()).contains(node.getId())) {            // resolve conflict has already be done with node with the same id            // => job already done            return;        }        Collection conflicts = new HashSet();        if (parent.getResolvedNodes(node.getModuleId(), node.getRootModuleConf()).removeAll(toevict)) {            // parent.resolved(node.mid) is not up to date:            // recompute resolved from all sub nodes            Collection deps = parent.getDependencies(parent.getRequiredConfigurations());            for (Iterator iter = deps.iterator(); iter.hasNext();) {                IvyNode dep = (IvyNode)iter.next();                conflicts.addAll(dep.getResolvedNodes(node.getModuleId(), node.getRootModuleConf()));            }        } else {            conflicts.add(node);            conflicts.addAll(parent.getResolvedNodes(node.getModuleId(), node.getRootModuleConf()));        }        Collection resolved = parent.getConflictManager(node.getModuleId()).resolveConflicts(parent, conflicts);        if (resolved.contains(node)) {            // node has been selected for the current parent            // we update its eviction... but it can still be evicted by parent !            node.markSelected(node.getRootModuleConf());            Message.debug("selecting "+node+" in "+parent);                        // handle previously selected nodes that are now evicted by this new node            toevict = parent.getResolvedNodes(node.getModuleId(), node.getRootModuleConf());            toevict.removeAll(resolved);                        for (Iterator iter = toevict.iterator(); iter.hasNext();) {                IvyNode te = (IvyNode)iter.next();                te.markEvicted(node.getRootModuleConf(), parent, parent.getConflictManager(node.getModuleId()), resolved);                                Message.debug("evicting "+te+" by "+te.getEvictedData(node.getRootModuleConf()));            }                        // it's very important to update resolved BEFORE recompute parent call            // to allow it to recompute its resolved collection with correct data            // if necessary            parent.setResolvedNodes(node.getModuleId(), node.getRootModuleConf(), resolved);             resolveConflict(node, parent.getParent(), toevict);        } else {            // node has been evicted for the current parent                        // it's time to update parent resolved with found resolved...            // if they have not been recomputed, it does not change anything            parent.setResolvedNodes(node.getModuleId(), node.getRootModuleConf(), resolved);                         node.markEvicted(node.getRootModuleConf(), parent, parent.getConflictManager(node.getModuleId()), resolved);            Message.debug("evicting "+node+" by "+node.getEvictedData(node.getRootModuleConf()));        }    }