You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/12/17 23:40:51 UTC

[maven] 01/01: [MNG-7636] Document MavenProject#getAttachedArtifacts() to be read-only in Maven 4

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

michaelo pushed a commit to branch MNG-7636_maven-3.9.x
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 31198fd756e70c9e0c0a99a728c8f4c120e29d5e
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Dec 18 00:21:30 2022 +0100

    [MNG-7636] Document MavenProject#getAttachedArtifacts() to be read-only in Maven 4
---
 .../src/main/java/org/apache/maven/project/MavenProject.java   | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
index c9f557ccd..fe638f0f7 100644
--- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
+++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
@@ -794,11 +794,19 @@ public class MavenProject implements Cloneable {
         }
     }
 
+    /**
+     * Returns a mutable list of the attached artifacts to this project. It is highly advised <em>not</em>
+     * to modify this list, but rather use the {@link MavenProjectHelper}.
+     * <p>
+     * <strong>Note</strong>: This list will be made read-only Maven 4.
+     *
+     * @return the attached artifacts of this project
+     */
     public List<Artifact> getAttachedArtifacts() {
         if (attachedArtifacts == null) {
             attachedArtifacts = new ArrayList<>();
         }
-        return Collections.unmodifiableList(attachedArtifacts);
+        return attachedArtifacts;
     }
 
     public Xpp3Dom getGoalConfiguration(