svn commit: r1811599 - in /maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection: ArtifactTransitivityFilter.java ProjectTransitivityFilter.java ScopeFilter.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1811599 - in /maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection: ArtifactTransitivityFilter.java ProjectTransitivityFilter.java ScopeFilter.java

michaelo
Author: michaelo
Date: Mon Oct  9 19:51:29 2017
New Revision: 1811599

URL: http://svn.apache.org/viewvc?rev=1811599&view=rev
Log:
[MSHARED-631] Several filters do not preserve order of artifacts filtered

This closes #20

Modified:
    maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactTransitivityFilter.java
    maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ProjectTransitivityFilter.java
    maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ScopeFilter.java

Modified: maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactTransitivityFilter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactTransitivityFilter.java?rev=1811599&r1=1811598&r2=1811599&view=diff
==============================================================================
--- maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactTransitivityFilter.java (original)
+++ maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactTransitivityFilter.java Mon Oct  9 19:51:29 2017
@@ -29,7 +29,7 @@ import org.apache.maven.project.ProjectB
 import org.apache.maven.project.ProjectBuildingResult;
 
 import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -179,7 +179,7 @@ public class ArtifactTransitivityFilter
     public Set<Artifact> filter( Set<Artifact> artifacts )
     {
 
-        Set<Artifact> result = new HashSet<Artifact>();
+        Set<Artifact> result = new LinkedHashSet<Artifact>();
         for ( Artifact artifact : artifacts )
         {
             if ( artifactIsATransitiveDependency( artifact ) )

Modified: maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ProjectTransitivityFilter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ProjectTransitivityFilter.java?rev=1811599&r1=1811598&r2=1811599&view=diff
==============================================================================
--- maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ProjectTransitivityFilter.java (original)
+++ maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ProjectTransitivityFilter.java Mon Oct  9 19:51:29 2017
@@ -19,7 +19,7 @@ package org.apache.maven.shared.artifact
  * under the License.    
  */
 
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
@@ -57,7 +57,7 @@ public class ProjectTransitivityFilter
 
         if ( excludeTransitive )
         {
-            result = new HashSet<Artifact>();
+            result = new LinkedHashSet<Artifact>();
             for ( Artifact artifact : artifacts )
             {
                 if ( artifactIsADirectDependency( artifact ) )

Modified: maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ScopeFilter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ScopeFilter.java?rev=1811599&r1=1811598&r2=1811599&view=diff
==============================================================================
--- maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ScopeFilter.java (original)
+++ maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ScopeFilter.java Mon Oct  9 19:51:29 2017
@@ -19,7 +19,7 @@ package org.apache.maven.shared.artifact
  * under the License.    
  */
 
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
@@ -73,7 +73,7 @@ public class ScopeFilter
                 throw new ArtifactFilterException( "Invalid Scope in includeScope: " + includeScope );
             }
 
-            results = new HashSet<Artifact>();
+            results = new LinkedHashSet<Artifact>();
 
             if ( Artifact.SCOPE_PROVIDED.equals( includeScope ) || Artifact.SCOPE_SYSTEM.equals( includeScope ) )
             {
@@ -100,7 +100,7 @@ public class ScopeFilter
             {
                 throw new ArtifactFilterException( "Invalid Scope in excludeScope: " + excludeScope );
             }
-            results = new HashSet<Artifact>();
+            results = new LinkedHashSet<Artifact>();
             // plexus ScopeArtifactFilter doesn't handle the provided scope so
             // we
             // need special handling for it.
@@ -131,7 +131,7 @@ public class ScopeFilter
 
     private Set<Artifact> includeSingleScope( Set<Artifact> artifacts, String scope )
     {
-        Set<Artifact> results = new HashSet<Artifact>();
+        Set<Artifact> results = new LinkedHashSet<Artifact>();
         for ( Artifact artifact : artifacts )
         {
             if ( scope.equals( artifact.getScope() ) )
@@ -144,7 +144,7 @@ public class ScopeFilter
 
     private Set<Artifact> excludeSingleScope( Set<Artifact> artifacts, String scope )
     {
-        Set<Artifact> results = new HashSet<Artifact>();
+        Set<Artifact> results = new LinkedHashSet<Artifact>();
         for ( Artifact artifact : artifacts )
         {
             if ( !scope.equals( artifact.getScope() ) )