This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch maven-4.0.x
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/maven-4.0.x by this push:
new ad2ef09a75 Add missing equals and hashCode methods in modular Java
path type. (#11130)
ad2ef09a75 is described below
commit ad2ef09a758e577c112059f9a30c9238fb3c98d1
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Wed Sep 17 12:58:12 2025 +0200
Add missing equals and hashCode methods in modular Java path type. (#11130)
---
.../main/java/org/apache/maven/api/JavaPathType.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git
a/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java
b/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java
index 7c11ec36da..58812db8b2 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java
@@ -376,6 +376,25 @@ public String[] option(Iterable<? extends Path> paths) {
return format(moduleName, paths);
}
+ /**
+ * {@return a hash code value based on the raw type and module name}.
+ */
+ @Override
+ public int hashCode() {
+ return rawType().hashCode() + 17 * moduleName.hashCode();
+ }
+
+ /**
+ * {@return whether the given object represents the same type of path
as this object}.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Modular m) {
+ return rawType() == m.rawType() &&
moduleName.equals(m.moduleName);
+ }
+ return false;
+ }
+
/**
* Returns the programmatic name of this path type, including the
module to patch.
* For example, if this type was created by {@code
JavaPathType.patchModule("foo.bar")},