elharo opened a new issue, #132:
URL: https://github.com/apache/maven-dependency-tree/issues/132

   ## Summary
   `AncestorOrSelfDependencyNodeFilter` matches nodes with `equals(...)`, but 
the node implementations do not override `equals`/`hashCode`, so the comparison 
is identity-based. The filter therefore only works when the candidate nodes are 
the exact same instances as the descendants, and silently matches nothing when 
applied to a rebuilt tree.
   
   ## Affected code
   - 
`src/main/java/org/apache/maven/shared/dependency/graph/filter/AncestorOrSelfDependencyNodeFilter.java:82-92`
 — `isAncestorOrSelf(...)` compares with `ancestorNode.equals(descendantNode)`
   - 
`src/main/java/org/apache/maven/shared/dependency/graph/internal/DefaultDependencyNode.java`
 — no `equals`/`hashCode` override
   
   ## Impact
   `maven-dependency-plugin` combines this filter with 
`BuildingDependencyNodeVisitor` (which clones the tree). Because the clone 
produces different node instances, the ancestor-or-self matches never succeed 
and the filtered output is empty, even though the graph logically contains the 
nodes.
   
   ## Suggested fix
   Implement value-based `equals`/`hashCode` on the node classes (e.g. by 
artifact coordinates), or compare by artifact in the filter instead of relying 
on node identity.


-- 
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