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 3bad5068a2 [MNG-8025] Restore compatibility (#1467)
3bad5068a2 is described below

commit 3bad5068a2025abd8a1cc1e806121e27aa18db90
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Tue Apr 23 15:29:46 2024 +0200

    [MNG-8025] Restore compatibility (#1467)
---
 api/maven-api-model/src/main/mdo/maven.mdo         | 79 ++++++++++------------
 .../src/main/java/org/fusesource/jansi/Ansi.java   |  4 ++
 maven-model/pom.xml                                |  3 -
 3 files changed, 41 insertions(+), 45 deletions(-)

diff --git a/api/maven-api-model/src/main/mdo/maven.mdo 
b/api/maven-api-model/src/main/mdo/maven.mdo
index 319341d31d..da8353c58a 100644
--- a/api/maven-api-model/src/main/mdo/maven.mdo
+++ b/api/maven-api-model/src/main/mdo/maven.mdo
@@ -652,36 +652,18 @@
           <version>4.0.0/4.0.99</version>
           <code>
             <![CDATA[
-    Map<String, Plugin> pluginMap;
-
     /**
      * Reset the {@code pluginsMap} field to {@code null}
      */
-    public synchronized void flushPluginMap()
-    {
-        this.pluginMap = null;
+    public void flushPluginMap() {
     }
 
     /**
      * @return a Map of plugins field with {@code Plugins#getKey()} as key
      * @see Plugin#getKey()
      */
-    public synchronized Map<String, Plugin> getPluginsAsMap()
-    {
-        if ( pluginMap == null )
-        {
-            pluginMap = new java.util.LinkedHashMap<String, Plugin>();
-            if ( getPlugins() != null )
-            {
-                for ( java.util.Iterator<Plugin> it = getPlugins().iterator(); 
it.hasNext(); )
-                {
-                    Plugin plugin = (Plugin) it.next();
-                    pluginMap.put( plugin.getKey(), plugin );
-                }
-            }
-        }
-
-        return pluginMap;
+    public Map<String, Plugin> getPluginsAsMap() {
+        return getPlugins().stream().collect(Collectors.toMap(plugin -> 
plugin.getKey(), plugin -> plugin));
     }
             ]]>
           </code>
@@ -2298,6 +2280,17 @@
         return ( getInherited() != null ) ? Boolean.parseBoolean( 
getInherited() ) : true;
     }
 
+            ]]>
+          </code>
+        </codeSegment>
+        <codeSegment>
+          <version>4.0.0/4.0.99</version>
+          <code>
+            <![CDATA[
+    @Deprecated
+    public void unsetInheritanceApplied() {
+    }
+
             ]]>
           </code>
         </codeSegment>
@@ -2389,20 +2382,12 @@
     public void setExtensions(boolean extensions) {
         setExtensions(String.valueOf(extensions));
     }
-            ]]>
-          </code>
-        </codeSegment>
-        <codeSegment>
-          <version>4.0.0+</version>
-          <code>
-            <![CDATA[
-    private Map<String, PluginExecution> executionMap = null;
 
     /**
      * Reset the {@code executionMap} field to {@code null}
      */
+     @Deprecated
     public void flushExecutionMap() {
-        this.executionMap = null;
     }
 
     /**
@@ -2410,19 +2395,15 @@
      * @see PluginExecution#getId()
      */
     public Map<String, PluginExecution> getExecutionsAsMap() {
-        if (executionMap == null) {
-            executionMap = new java.util.LinkedHashMap<String, 
PluginExecution>();
-            for (java.util.Iterator<PluginExecution> i = 
getExecutions().iterator(); i.hasNext();) {
-                PluginExecution exec = (PluginExecution) i.next();
-                if (executionMap.containsKey(exec.getId())) {
-                    throw new IllegalStateException("You cannot have two 
plugin executions with the same (or missing) <id/> elements.\nOffending 
execution\n\nId: \'" + exec.getId() + "\'\nPlugin:\'" + getKey() + "\'\n\n");
-                }
-                executionMap.put(exec.getId(), exec);
-            }
-        }
-        return executionMap;
+        return getExecutions().stream().collect(Collectors.toMap(exec -> 
exec.getId(), exec -> exec));
     }
-
+            ]]>
+          </code>
+        </codeSegment>
+        <codeSegment>
+          <version>4.0.0+</version>
+          <code>
+            <![CDATA[
     /**
      * Gets the identifier of the plugin.
      *
@@ -2646,6 +2627,20 @@
         setExcludeDefaults(String.valueOf(excludeDefaults));
     }
 
+    /**
+     * Reset the <code>reportPluginMap</code> field to <code>null</code>
+     */
+    @Deprecated
+    public void flushReportPluginMap() {
+    }
+
+    /**
+     * @return a Map of plugins field with <code>ReportPlugin#getKey()</code> 
as key
+     * @see org.apache.maven.model.ReportPlugin#getKey()
+     */
+    public java.util.Map<String, ReportPlugin> getReportPluginsAsMap() {
+        return getPlugins().stream().collect(Collectors.toMap(report -> 
report.getKey(), report -> report));
+    }
             ]]>
           </code>
         </codeSegment>
diff --git a/maven-embedder/src/main/java/org/fusesource/jansi/Ansi.java 
b/maven-embedder/src/main/java/org/fusesource/jansi/Ansi.java
index 9c9184bc38..3bdb850aaf 100644
--- a/maven-embedder/src/main/java/org/fusesource/jansi/Ansi.java
+++ b/maven-embedder/src/main/java/org/fusesource/jansi/Ansi.java
@@ -163,6 +163,10 @@ public class Ansi implements Appendable {
         return org.apache.maven.jline.MessageUtils.isColorEnabled() && 
org.jline.jansi.Ansi.isEnabled();
     }
 
+    public static void setEnabled(final boolean flag) {
+        org.jline.jansi.Ansi.setEnabled(flag);
+    }
+
     public static Ansi ansi() {
         if (isEnabled()) {
             return new Ansi();
diff --git a/maven-model/pom.xml b/maven-model/pom.xml
index d976eae2e0..f5ed2e1058 100644
--- a/maven-model/pom.xml
+++ b/maven-model/pom.xml
@@ -123,7 +123,6 @@ under the License.
               
<exclude>org.apache.maven.model.*#setOtherLocation(java.lang.Object,org.apache.maven.model.InputLocation):METHOD_REMOVED</exclude>
               
<exclude>org.apache.maven.model.ConfigurationContainer#isInheritanceApplied():METHOD_REMOVED</exclude>
               
<exclude>org.apache.maven.model.ConfigurationContainer#setInherited(boolean):METHOD_REMOVED</exclude>
-              
<exclude>org.apache.maven.model.ConfigurationContainer#unsetInheritanceApplied():METHOD_REMOVED</exclude>
               
<exclude>org.apache.maven.model.Contributor#addProperty(java.lang.String,java.lang.String):METHOD_REMOVED</exclude>
               
<exclude>org.apache.maven.model.Dependency#clearManagementKey():METHOD_REMOVED</exclude>
               
<exclude>org.apache.maven.model.ModelBase#addProperty(java.lang.String,java.lang.String):METHOD_REMOVED</exclude>
@@ -132,8 +131,6 @@ under the License.
               
<exclude>org.apache.maven.model.Notifier#addConfiguration(java.lang.String,java.lang.String):METHOD_REMOVED</exclude>
               
<exclude>org.apache.maven.model.Plugin#getGoals():METHOD_REMOVED</exclude>
               
<exclude>org.apache.maven.model.Plugin#setGoals(java.lang.Object):METHOD_REMOVED</exclude>
-              
<exclude>org.apache.maven.model.Reporting#flushReportPluginMap():METHOD_REMOVED</exclude>
-              
<exclude>org.apache.maven.model.Reporting#getReportPluginsAsMap():METHOD_REMOVED</exclude>
               
<exclude>org.apache.maven.model.Resource#initMergeId():METHOD_REMOVED</exclude>
               
<exclude>org.apache.maven.model.Scm#setChildScmConnectionInheritAppendPath(boolean):METHOD_REMOVED</exclude>
               
<exclude>org.apache.maven.model.Scm#setChildScmDeveloperConnectionInheritAppendPath(boolean):METHOD_REMOVED</exclude>

Reply via email to