gnodet commented on PR #2175:
URL: https://github.com/apache/maven-resolver/pull/2175#issuecomment-6061963193

   No, `PathConflictResolver` is independent of how the collector traverses the 
graph. The BFS here refers exclusively to the traversal order **inside** 
`gatherCRNodes` — the internal method that walks the already-collected 
dependency graph to build the set of conflict-resolution nodes.
   
   The issue was that `gatherCRNodes` used a LIFO stack (DFS), which does not 
guarantee that a shared `DependencyNode` instance is first encountered at its 
minimum reachable depth. When the resolver's `DataPool` reuses the same 
`DependencyNode` instance across multiple parent paths at different depths, DFS 
can process a deeper occurrence first — recording the wrong depth in the 
`expandedNodes` guard — which then causes duplicate partition entries and 
corrupts the resolved graph.
   
   Switching to a FIFO queue (BFS) inside `gatherCRNodes` guarantees that the 
first time any `DependencyNode` is dequeued it is at its minimum reachable 
depth, so the guard correctly suppresses all deeper/equal occurrences without 
re-enqueueing.
   
   The DependencyCollector (which assembles the graph in the first place) is a 
separate concern and its traversal strategy is unaffected.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to