You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/02/26 15:35:40 UTC

[GitHub] [maven-gpg-plugin] Syquel commented on a change in pull request #11: [MGPG-81] check format in constructor

Syquel commented on a change in pull request #11:
URL: https://github.com/apache/maven-gpg-plugin/pull/11#discussion_r583724425



##########
File path: src/main/java/org/apache/maven/plugins/gpg/GpgVersion.java
##########
@@ -32,54 +32,46 @@
  */
 public class GpgVersion implements Comparable<GpgVersion>
 {
-    private final String rawVersion;
 
-    private GpgVersion( String rawVersion )
-    {
-        this.rawVersion = rawVersion;
-    }
+    private static final Pattern VERSION_PATTERN = Pattern.compile( "(\\d+\\.)+(\\d+)" );
 
-    public static GpgVersion parse( String rawVersion )
+    private final int[] versionSegments;
+
+    private GpgVersion( int... versionSegments )
     {
-        return new GpgVersion( rawVersion );
+        this.versionSegments = versionSegments;
     }
 
-    @Override
-    public int compareTo( GpgVersion other )
+    public static GpgVersion parse( String rawVersion )

Review comment:
       As far as I can see the original author of this class made the assumption that it will always be a sequence of numbers delimited by dots (although the original author wrote in the class-level comment, that this is a SemVer parser).
   The raw version string is read from the output of `gpg --version` apparently.
   
   Unfortunately I am in no position to evaluate whether GPG will continue using this versioning scheme, but it seems they have consistently used it up until now: https://files.gpg4win.org/
   In my opinion we can make the assumption, that GPG will continue using a three segment wide versioning scheme just as the original author implemented it.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org