You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2021/01/25 20:24:54 UTC

[maven-enforcer] branch pr/81 updated (1820a17 -> fe790e0)

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

slachiewicz pushed a change to branch pr/81
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git.


    omit 1820a17  simplify code: use containsVersion from VersionRange instead of Restriction
     add eba6d2d  Bump junit from 4.13 to 4.13.1
     add 9fd19b6  Bump assertj-core from 1.7.1 to 2.9.1
     add 086204b  [MENFORCER-351] Added check to avoid NPE with old Eclipse versions
     add 355f845  [MENFORCER-350] Added few tests to validate issue
     add bd993c2  [MENFORCER-313] - Added [<scope>] to the conflicting artifacts in the
     add 1d3e6b1  Bump commons-codec from 1.14 to 1.15
     add 19d4cac  Bump mrm-maven-plugin from 1.0.0 to 1.2.0
     add 419b87b  update resolver
     add cba4ddd  Merge pull request #84 from apache/resolver
     add bf46924  update commons IO
     add 50a5457  Merge pull request #82 from apache/ver
     add a3d57a4  Remove Travis config
     add 2742cb4  [MENFORCER-371] Require Maven 3.1.1
     add d0349eb  [MENFORCER-371] Update dependency to maven-compat
     add b49bd3b  [MENFORCER-371] Drop dep to old plexus-container-default - use default new org.eclipse.sisu.inject one
     new fe790e0  simplify code: use containsVersion from VersionRange instead of Restriction

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (1820a17)
            \
             N -- N -- N   refs/heads/pr/81 (fe790e0)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .travis.yml                                        | 33 ---------------
 enforcer-api/pom.xml                               |  5 ---
 enforcer-rules/pom.xml                             |  2 +
 .../plugins/enforcer/RequireMavenVersion.java      |  5 +++
 .../plugins/enforcer/RequireUpperBoundDeps.java    | 14 ++++++-
 .../maven/plugins/enforcer/EnforcerTestUtils.java  |  3 +-
 .../maven/plugins/enforcer/TestMavenVersion.java   | 49 +++++++++++++++++++++-
 maven-enforcer-plugin/pom.xml                      |  2 +-
 .../invoker.properties                             |  0
 .../pom.xml                                        |  4 +-
 .../verify.groovy                                  | 13 +++---
 pom.xml                                            | 17 ++++----
 12 files changed, 87 insertions(+), 60 deletions(-)
 delete mode 100644 .travis.yml
 copy maven-enforcer-plugin/src/it/projects/{require-upper-bound-deps_includes => require-upper-bound-deps_failure_show_scopes}/invoker.properties (100%)
 copy maven-enforcer-plugin/src/it/projects/{require-upper-bound-deps_failure => require-upper-bound-deps_failure_show_scopes}/pom.xml (95%)
 copy maven-enforcer-plugin/src/it/projects/{require-upper-bound-deps_failure => require-upper-bound-deps_failure_show_scopes}/verify.groovy (82%)


[maven-enforcer] 01/01: simplify code: use containsVersion from VersionRange instead of Restriction

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit fe790e09585e2996efe788b17401c8596e317b73
Author: madlexa <le...@trifle.one>
AuthorDate: Fri Nov 27 15:59:19 2020 +0700

    simplify code: use containsVersion from VersionRange instead of Restriction
---
 .../maven/plugins/enforcer/AbstractVersionEnforcer.java | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
index bedf7dd..f10215e 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
@@ -19,11 +19,8 @@ package org.apache.maven.plugins.enforcer;
  * under the License.
  */
 
-import java.util.List;
-
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.Restriction;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.enforcer.rule.api.EnforcerRule;
 import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
@@ -125,28 +122,18 @@ public abstract class AbstractVersionEnforcer
      */
     public static boolean containsVersion( VersionRange allowedRange, ArtifactVersion theVersion )
     {
-        boolean matched = false;
         ArtifactVersion recommendedVersion = allowedRange.getRecommendedVersion();
         if ( recommendedVersion == null )
         {
-            List<Restriction> restrictions = allowedRange.getRestrictions();
-            for ( Restriction restriction : restrictions )
-            {
-                if ( restriction.containsVersion( theVersion ) )
-                {
-                    matched = true;
-                    break;
-                }
-            }
+            return allowedRange.containsVersion( theVersion );
         }
         else
         {
             // only singular versions ever have a recommendedVersion
             @SuppressWarnings( "unchecked" )
             int compareTo = recommendedVersion.compareTo( theVersion );
-            matched = ( compareTo <= 0 );
+            return ( compareTo <= 0 );
         }
-        return matched;
     }
 
     @Override