maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khmarba...@apache.org
Subject [maven-enforcer] branch master updated: [MENFORCER-221] Removed deprecated marked constructor from EnforcerExpressionEvaluator
Date Sat, 06 Jan 2018 17:32:16 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 655a24e  [MENFORCER-221] Removed deprecated marked constructor from EnforcerExpressionEvaluator
655a24e is described below

commit 655a24e6d3b72c5cb6d5fa9448206eccea3834ee
Author: Karl Heinz Marbaise <khmarbaise@apache.org>
AuthorDate: Sat Jan 6 18:06:08 2018 +0100

    [MENFORCER-221] Removed deprecated marked constructor from EnforcerExpressionEvaluator
---
 .../enforcer/EnforcerExpressionEvaluator.java      | 27 +++-------------------
 .../maven/plugins/enforcer/EnforcerTestUtils.java  |  3 +--
 .../utils/MockEnforcerExpressionEvaluator.java     |  8 ++-----
 .../utils/TestMockEnforcerExpressionEvaluator.java | 14 +++++------
 .../apache/maven/plugins/enforcer/EnforceMojo.java | 25 +-------------------
 5 files changed, 13 insertions(+), 64 deletions(-)

diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforcerExpressionEvaluator.java
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforcerExpressionEvaluator.java
index 0d13874..c7385e9 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforcerExpressionEvaluator.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforcerExpressionEvaluator.java
@@ -22,9 +22,6 @@ package org.apache.maven.plugins.enforcer;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.PluginParameterExpressionEvaluator;
-import org.apache.maven.plugin.descriptor.MojoDescriptor;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.path.PathTranslator;
 
 /**
  * The Class EnforcerExpressionEvaluator. This class wraps the PluginParameterExpressionEvaluator
because it can't be
@@ -39,30 +36,12 @@ public class EnforcerExpressionEvaluator
     /**
      * The Constructor.
      *
-     * @param theContext {@link MavenSession}
-     * @param thePathTranslator {@link PathTranslator}
-     * @param theProject {@link MavenProject}
+     * @param mavenSession {@link MavenSession}
      * @param theExecution {@link MojoExecution}
      */
-    public EnforcerExpressionEvaluator( MavenSession theContext, PathTranslator thePathTranslator,
-                                        MavenProject theProject, MojoExecution theExecution
)
+    public EnforcerExpressionEvaluator( MavenSession mavenSession, MojoExecution theExecution
)
     {
-        super( theContext, theExecution, thePathTranslator, null, theProject, theContext.getExecutionProperties()
);
+        super( mavenSession, theExecution );
     }
 
-    /**
-     * This constructor is kept for backward compatibility.
-     * 
-     * @param theContext {@link MavenSession}
-     * @param thePathTranslator {@link PathTranslator}
-     * @param theProject {@link MavenProject}
-     * 
-     * @deprecated Will be removed with 2.0
-     */
-    public EnforcerExpressionEvaluator( MavenSession theContext, PathTranslator thePathTranslator,
-                                        MavenProject theProject )
-    {
-        super( theContext, new MojoExecution( new MojoDescriptor() ), thePathTranslator,
null, theProject,
-               theContext.getExecutionProperties() );
-    }
 }
diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/EnforcerTestUtils.java
b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/EnforcerTestUtils.java
index f1bd2c3..2b51f35 100644
--- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/EnforcerTestUtils.java
+++ b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/EnforcerTestUtils.java
@@ -127,11 +127,10 @@ public final class EnforcerTestUtils
         ExpressionEvaluator eval;
         if ( mockExpression )
         {
-            eval = new MockEnforcerExpressionEvaluator( session, new MockPathTranslator(),
project );
+            eval = new MockEnforcerExpressionEvaluator( session );
         }
         else
         {
-//            eval = new DefaultExpressionEvaluator();
             MojoExecution mockExecution = mock( MojoExecution.class );
             session.setCurrentProject( project );
             eval = new PluginParameterExpressionEvaluator( session, mockExecution );
diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/utils/MockEnforcerExpressionEvaluator.java
b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/utils/MockEnforcerExpressionEvaluator.java
index 5ba9771..4ce3295 100644
--- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/utils/MockEnforcerExpressionEvaluator.java
+++ b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/utils/MockEnforcerExpressionEvaluator.java
@@ -23,8 +23,6 @@ import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugins.enforcer.EnforcerExpressionEvaluator;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.path.PathTranslator;
 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
 
 /**
@@ -41,11 +39,9 @@ public class MockEnforcerExpressionEvaluator
      * @param thePathTranslator the the path translator
      * @param theProject the the project
      */
-    public MockEnforcerExpressionEvaluator( MavenSession theContext, PathTranslator thePathTranslator,
-                                            MavenProject theProject )
+    public MockEnforcerExpressionEvaluator( MavenSession theContext )
     {
-        super( theContext, thePathTranslator, theProject, new MojoExecution( new MojoDescriptor()
) );
-        // TODO Auto-generated constructor stub
+        super( theContext, new MojoExecution( new MojoDescriptor() ) );
     }
 
     /*
diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/utils/TestMockEnforcerExpressionEvaluator.java
b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/utils/TestMockEnforcerExpressionEvaluator.java
index 90336b6..ef8ba87 100644
--- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/utils/TestMockEnforcerExpressionEvaluator.java
+++ b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/utils/TestMockEnforcerExpressionEvaluator.java
@@ -1,5 +1,10 @@
 package org.apache.maven.plugins.enforcer.utils;
 
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugins.enforcer.EnforcerExpressionEvaluator;
+import org.apache.maven.plugins.enforcer.EnforcerTestUtils;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -21,13 +26,6 @@ package org.apache.maven.plugins.enforcer.utils;
 
 import junit.framework.TestCase;
 
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugins.enforcer.EnforcerExpressionEvaluator;
-import org.apache.maven.plugins.enforcer.EnforcerTestUtils;
-import org.apache.maven.plugins.enforcer.MockPathTranslator;
-import org.apache.maven.plugins.enforcer.MockProject;
-import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
-
 /**
  * The Class TestMockEnforcerExpressionEvaluator.
  */
@@ -43,7 +41,7 @@ public class TestMockEnforcerExpressionEvaluator
         MavenSession session = EnforcerTestUtils.getMavenSession();
 
         EnforcerExpressionEvaluator ev =
-            new MockEnforcerExpressionEvaluator( session, new MockPathTranslator(), new MockProject()
);
+            new MockEnforcerExpressionEvaluator( session );
         assertMatch( ev, "SNAPSHOT" );
         assertMatch( ev, "RELEASE" );
         assertMatch( ev, "SNAPSHOT" );
diff --git a/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
b/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
index 1173c26..2048b8d 100644
--- a/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
+++ b/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
@@ -33,13 +33,11 @@ import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.path.PathTranslator;
 import org.codehaus.plexus.PlexusConstants;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.context.Context;
@@ -65,12 +63,6 @@ public class EnforceMojo
     protected static Hashtable<String, EnforcerRule> cache = new Hashtable<String,
EnforcerRule>();
 
     /**
-     * Path Translator needed by the ExpressionEvaluator
-     */
-    @Component( role = PathTranslator.class )
-    protected PathTranslator translator;
-
-    /**
      * MojoExecution needed by the ExpressionEvaluator
      */
     @Parameter( defaultValue = "${mojoExecution}", readonly = true, required = true )
@@ -145,7 +137,7 @@ public class EnforceMojo
         Log log = this.getLog();
 
         EnforcerExpressionEvaluator evaluator =
-            new EnforcerExpressionEvaluator( session, translator, project, mojoExecution
);
+            new EnforcerExpressionEvaluator( session, mojoExecution );
 
         if ( isSkip() )
         {
@@ -326,14 +318,6 @@ public class EnforceMojo
     }
 
     /**
-     * @param theTranslator the translator to set
-     */
-    public void setTranslator( PathTranslator theTranslator )
-    {
-        this.translator = theTranslator;
-    }
-
-    /**
      * Returns the level of the rule, defaults to {@link EnforcerLevel#ERROR} for backwards
compatibility.
      *
      * @param rule might be of type {@link EnforcerRule2}.
@@ -399,11 +383,4 @@ public class EnforceMojo
         this.session = theSession;
     }
 
-    /**
-     * @return the translator
-     */
-    public PathTranslator getTranslator()
-    {
-        return this.translator;
-    }
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@maven.apache.org" <commits@maven.apache.org>'].

Mime
View raw message