You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2020/04/23 20:34:27 UTC

[maven-gpg-plugin] branch MGPG-78 updated (58a4a7c -> a3e2223)

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

tibordigana pushed a change to branch MGPG-78
in repository https://gitbox.apache.org/repos/asf/maven-gpg-plugin.git.


 discard 58a4a7c  make equals and compareTo consistent with Java requirements
     new a3e2223  make equals and compareTo consistent with Java requirements

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (58a4a7c)
            \
             N -- N -- N   refs/heads/MGPG-78 (a3e2223)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/main/java/org/apache/maven/plugins/gpg/GpgVersion.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)


[maven-gpg-plugin] 01/01: make equals and compareTo consistent with Java requirements

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch MGPG-78
in repository https://gitbox.apache.org/repos/asf/maven-gpg-plugin.git

commit a3e2223468bcae65732bb68734ff8c9ddd03560d
Author: tibordigana <ti...@apache.org>
AuthorDate: Thu Apr 23 22:13:35 2020 +0200

    make equals and compareTo consistent with Java requirements
---
 .../org/apache/maven/plugins/gpg/GpgVersion.java   | 31 +++++++++++++++++++++-
 .../apache/maven/plugins/gpg/GpgVersionTest.java   | 14 ++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/plugins/gpg/GpgVersion.java b/src/main/java/org/apache/maven/plugins/gpg/GpgVersion.java
index 35b33e0..4701e5f 100644
--- a/src/main/java/org/apache/maven/plugins/gpg/GpgVersion.java
+++ b/src/main/java/org/apache/maven/plugins/gpg/GpgVersion.java
@@ -30,7 +30,7 @@ import java.util.regex.Pattern;
  * @author Robert Scholte
  * @since 3.0.0
  */
-public class GpgVersion implements Comparable<GpgVersion>
+public final class GpgVersion implements Comparable<GpgVersion>
 {
     private final String rawVersion;
 
@@ -140,4 +140,33 @@ public class GpgVersion implements Comparable<GpgVersion>
         return rawVersion;
     }
 
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        try
+        {
+            GpgVersion that = (GpgVersion) o;
+            return compareTo( that ) == 0;
+        }
+        catch ( IllegalArgumentException e )
+        {
+            return false;
+        }
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return 1;
+    }
 }
diff --git a/src/test/java/org/apache/maven/plugins/gpg/GpgVersionTest.java b/src/test/java/org/apache/maven/plugins/gpg/GpgVersionTest.java
index 504f5a5..57eb9c3 100644
--- a/src/test/java/org/apache/maven/plugins/gpg/GpgVersionTest.java
+++ b/src/test/java/org/apache/maven/plugins/gpg/GpgVersionTest.java
@@ -21,7 +21,9 @@ package org.apache.maven.plugins.gpg;
 
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 
 /**
@@ -48,4 +50,16 @@ public class GpgVersionTest
         assertFalse( GpgVersion.parse( "gpg (GnuPG) 2.0.26 (Gpg4win 2.2.3)" )
                 .isBefore( GpgVersion.parse( "2.0.26" ) ) );
     }
+
+    @Test
+    public void testEquals()
+    {
+        assertEquals( GpgVersion.parse( "gpg (GnuPG) 2.0.26 (Gpg4win 2.2.3)" ), GpgVersion.parse( "2.0.26" ) );
+    }
+
+    @Test
+    public void testNotEquals()
+    {
+        assertNotEquals( GpgVersion.parse( "gpg (GnuPG) 2.0.26 (Gpg4win 2.2.3)" ), GpgVersion.parse( "2.0" ) );
+    }
 }