michael-o commented on a change in pull request #358:
URL: https://github.com/apache/maven/pull/358#discussion_r433702024



##########
File path: maven-core/src/main/java/org/apache/maven/project/MavenProject.java
##########
@@ -921,12 +926,20 @@ public void setInjectedProfileIds( String source, 
List<String> injectedProfileId
      * 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 compatibility
      */
     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:
       No, it is not worth it. If the amount of elements is low, I am fine with 
indexed list access.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to