[maven] branch MNG-6948 created (now 65ec04c)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[maven] branch MNG-6948 created (now 65ec04c)

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

rfscholte pushed a change to branch MNG-6948
in repository https://gitbox.apache.org/repos/asf/maven.git.


      at 65ec04c  [MNG-6948] Repository files should not pass build-filters

This branch includes the following new commits:

     new 65ec04c  [MNG-6948] Repository files should not pass build-filters

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.


Reply | Threaded
Open this post in threaded view
|

[maven] 01/01: [MNG-6948] Repository files should not pass build-filters

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

rfscholte pushed a commit to branch MNG-6948
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 65ec04c2363b16d08b760fe7e494b56b347bffee
Author: rfscholte <[hidden email]>
AuthorDate: Mon Jun 29 20:35:31 2020 +0200

    [MNG-6948] Repository files should not pass build-filters
---
 .../maven/model/building/ArtifactModelSource.java  | 38 +++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/ArtifactModelSource.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/ArtifactModelSource.java
index c3f01c2..f87d41a 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/ArtifactModelSource.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/ArtifactModelSource.java
@@ -20,19 +20,25 @@ package org.apache.maven.model.building;
  */
 
 import java.io.File;
+import java.util.Objects;
+
+import org.apache.maven.building.FileSource;
 
 /**
+ * Represents a model pulled from a repository
  *
  * @author Robert Scholte
  * @since 3.7.0
  */
-public class ArtifactModelSource extends FileModelSource
+public class ArtifactModelSource extends FileSource implements ModelSource
 {
     private final String groupId;
     
     private final String artifactId;
     
     private final String version;
+    
+    private final int hashCode;
 
     public ArtifactModelSource( File file, String groupId, String artifactId, String version )
     {
@@ -40,6 +46,7 @@ public class ArtifactModelSource extends FileModelSource
         this.groupId = groupId;
         this.artifactId = artifactId;
         this.version = version;
+        this.hashCode = Objects.hash( groupId, artifactId, version );
     }
 
     public String getGroupId()
@@ -56,4 +63,33 @@ public class ArtifactModelSource extends FileModelSource
     {
         return version;
     }
+
+    @Override
+    public int hashCode()
+    {
+        return hashCode;
+    }
+
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+        if ( obj == null )
+        {
+            return false;
+        }
+
+        if ( !ArtifactModelSource.class.equals( obj.getClass() )  )
+        {
+            return false;
+        }
+
+        ArtifactModelSource other = (ArtifactModelSource) obj;
+        return Objects.equals( artifactId, other.artifactId )
+            && Objects.equals( groupId, other.groupId )
+            && Objects.equals( version, other.version );
+    }
 }