maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [maven] olamy commented on a change in pull request #358: [MNG-5868] No duplicate artifacts in attached artifacts
Date Tue, 02 Jun 2020 03:22:57 GMT

olamy commented on a change in pull request #358:

File path: maven-core/src/main/java/org/apache/maven/project/
@@ -921,12 +926,20 @@ public void setInjectedProfileIds( String source, List<String>
      * coordinates.
      * @param artifact the artifact to add or replace.
-     * @throws DuplicateArtifactAttachmentException
+     * @deprecated Please use {@link MavenProjectHelper}
+     * @throws DuplicateArtifactAttachmentException not used anymore but leave it for backward
     public void addAttachedArtifact( Artifact artifact )
         throws DuplicateArtifactAttachmentException
-        getAttachedArtifacts().add( artifact );
+        // if already there we remove it and add again
+        int index = attachedArtifacts.indexOf( artifact );

Review comment:
       we are talking about list of 6/7 elements which are not accessed that much especially
for add.
   My first idea was to use HashSet but this will make the `getAttachedArtifacts` method to
recreate a List based on the  Set and makes this new List unmodifiable as well.
   I can make some jmh to compare but not sure it really worth 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:

View raw message