diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DataPool.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DataPool.java index d5ac4162f..9e9849e03 100644 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DataPool.java +++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DataPool.java @@ -276,9 +276,11 @@ public void putChildren(Object key, List children) { public static final class DescriptorKey { private final Artifact artifact; + private final int hashCode; private DescriptorKey(Artifact artifact) { this.artifact = artifact; + this.hashCode = buildHashCode(); } @Override @@ -295,6 +297,10 @@ public boolean equals(Object o) { @Override public int hashCode() { + return hashCode; + } + + private int buildHashCode() { return Objects.hashCode(artifact); }