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

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new dc8ec4c97 Fix mutable api in PluginContainer (#1019)
dc8ec4c97 is described below

commit dc8ec4c973c0bba2c2e1f964b1e78a2d78729aee
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Mar 9 21:14:48 2023 +0100

    Fix mutable api in PluginContainer (#1019)
---
 api/maven-api-model/src/main/mdo/maven.mdo | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/api/maven-api-model/src/main/mdo/maven.mdo 
b/api/maven-api-model/src/main/mdo/maven.mdo
index 2aa927e46..a42a65531 100644
--- a/api/maven-api-model/src/main/mdo/maven.mdo
+++ b/api/maven-api-model/src/main/mdo/maven.mdo
@@ -624,7 +624,7 @@
       </fields>
       <codeSegments>
         <codeSegment>
-          <version>4.0.0+</version>
+          <version>4.0.0/4.1.0</version>
           <code>
             <![CDATA[
     Map<String, Plugin> pluginMap;
@@ -656,6 +656,31 @@
             }
         }
 
+        return pluginMap;
+    }
+            ]]>
+          </code>
+        </codeSegment>
+        <codeSegment>
+          <version>4.2.0+</version>
+          <code>
+            <![CDATA[
+    volatile Map<String, Plugin> pluginMap;
+
+    /**
+     * @return a Map of plugins field with {@code Plugins#getKey()} as key
+     * @see Plugin#getKey()
+     */
+    public Map<String, Plugin> getPluginsAsMap() {
+        if (pluginMap == null) {
+            synchronized (this) {
+                if (pluginMap == null) {
+                    pluginMap = 
ImmutableCollections.copy(plugins.stream().collect(
+                            java.util.stream.Collectors.toMap(
+                                Plugin::getKey, 
java.util.function.Function.identity())));
+                }
+            }
+        }
         return pluginMap;
     }
             ]]>

Reply via email to