You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/08/02 11:00:22 UTC
[I] AncestorOrSelfDependencyNodeFilter uses identity equality and fails on cloned trees [maven-dependency-tree]
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: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AncestorOrSelfDependencyNodeFilter uses identity equality and fails on cloned trees [maven-dependency-tree]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz commented on issue #132:
URL: https://github.com/apache/maven-dependency-tree/issues/132#issuecomment-6004156925
Closing: maven-dependency-tree is no longer used by any Apache Maven component and is planned for retirement, tracked in #150 ([vote](https://lists.apache.org/thread/xvqh2pjm8zq6k2h6kogzlksv37rzkcbx)). No further releases are planned. To migrate, call Maven Resolver directly, as #150 describes.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AncestorOrSelfDependencyNodeFilter uses identity equality and fails on cloned trees [maven-dependency-tree]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz closed issue #132: AncestorOrSelfDependencyNodeFilter uses identity equality and fails on cloned trees
URL: https://github.com/apache/maven-dependency-tree/issues/132
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org