You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2025/01/28 14:30:47 UTC

(maven) branch master updated: [MNG-8545] Use of RemoteRepository in keys w/o equals/hashes (#2064)

This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new 63e6881d98 [MNG-8545] Use of RemoteRepository in keys w/o equals/hashes (#2064)
63e6881d98 is described below

commit 63e6881d983782e79cbf610232d6903572037374
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Jan 28 15:30:41 2025 +0100

    [MNG-8545] Use of RemoteRepository in keys w/o equals/hashes (#2064)
    
    But they have no hash/equals defined.
    
    ---
    
    https://issues.apache.org/jira/browse/MNG-8545
---
 .../java/org/apache/maven/impl/DefaultRemoteRepository.java  | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultRemoteRepository.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultRemoteRepository.java
index 7bb02e4d5b..85de3f664a 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultRemoteRepository.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultRemoteRepository.java
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.impl;
 
+import java.util.Objects;
+
 import org.apache.maven.api.RemoteRepository;
 import org.apache.maven.api.annotations.Nonnull;
 
@@ -56,6 +58,16 @@ public String getProtocol() {
         return repository.getProtocol();
     }
 
+    @Override
+    public boolean equals(Object o) {
+        return o instanceof DefaultRemoteRepository that && Objects.equals(repository, that.repository);
+    }
+
+    @Override
+    public int hashCode() {
+        return repository.hashCode();
+    }
+
     @Override
     public String toString() {
         return repository.toString();