[maven] branch master updated: Fix checkstyle reported errors

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven] branch master updated: Fix checkstyle reported errors

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

rfscholte 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 38efe84  Fix checkstyle reported errors
38efe84 is described below

commit 38efe8444c91e7c1dbf489bc672841c9458ae9ec
Author: rfscholte <[hidden email]>
AuthorDate: Tue Sep 10 18:51:18 2019 +0200

    Fix checkstyle reported errors
---
 .../maven/artifact/versioning/VersionRange.java    |  7 ++-----
 .../artifact/resolver/DebugResolutionListener.java |  2 +-
 .../repository/MavenArtifactRepository.java        |  2 +-
 .../resolver/filter/ScopeArtifactFilter.java       |  7 +------
 .../java/org/apache/maven/plugin/CacheUtils.java   |  2 +-
 .../maven/plugin/DefaultPluginDescriptorCache.java | 13 +++++-------
 .../org/apache/maven/project/MavenProject.java     | 10 +++------
 .../artifact/DefaultMavenMetadataCache.java        | 24 +++++++++-------------
 .../apache/maven/toolchain/DefaultToolchain.java   |  9 ++------
 9 files changed, 26 insertions(+), 50 deletions(-)

diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java
index af37d18..bbc6523 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java
@@ -593,11 +593,8 @@ public class VersionRange
         }
         VersionRange other = (VersionRange) obj;
 
-        boolean equals =
-                Objects.equals(recommendedVersion, other.recommendedVersion);
-        equals &=
-                Objects.equals(restrictions, other.restrictions);
-        return equals;
+        return Objects.equals( recommendedVersion, other.recommendedVersion )
+            && Objects.equals( restrictions, other.restrictions );
     }
 
     public int hashCode()
diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java
index e011760..56c1805 100644
--- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java
+++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java
@@ -70,7 +70,7 @@ public class DebugResolutionListener
         String omittedVersion = omitted.getVersion();
         String keptVersion = kept.getVersion();
 
-        if (!Objects.equals(omittedVersion, keptVersion))
+        if ( !Objects.equals( omittedVersion, keptVersion ) )
         {
             logger.debug( indent + omitted + " (removed - nearer found: " + keptVersion + ")" );
         }
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
index 4c081a1..c330fda 100644
--- a/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
+++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
@@ -354,7 +354,7 @@ public class MavenArtifactRepository
 
     protected static <T> boolean eq( T s1, T s2 )
     {
-        return Objects.equals(s1, s2);
+        return Objects.equals( s1, s2 );
     }
 
     public Authentication getAuthentication()
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java b/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java
index 651acb4..d87ee85 100644
--- a/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java
+++ b/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java
@@ -69,12 +69,7 @@ public class ScopeArtifactFilter
 
         ScopeArtifactFilter other = (ScopeArtifactFilter) obj;
 
-        return equals( scope, other.scope );
-    }
-
-    private static <T> boolean equals( T str1, T str2 )
-    {
-        return Objects.equals(str1, str2);
+        return Objects.equals( scope, other.scope );
     }
 
 }
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java b/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
index ec874c6..118db83 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
@@ -39,7 +39,7 @@ class CacheUtils
     @Deprecated
     public static <T> boolean eq( T s1, T s2 )
     {
-        return Objects.equals(s1, s2);
+        return Objects.equals( s1, s2 );
     }
 
     /**
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java
index ba62888..0da9935 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java
@@ -194,9 +194,11 @@ public class DefaultPluginDescriptorCache
 
             CacheKey that = (CacheKey) obj;
 
-            return eq( this.artifactId, that.artifactId ) && eq( this.groupId, that.groupId )
-                && eq( this.version, that.version ) && eq( this.localRepo, that.localRepo )
-                && eq( this.workspace, that.workspace )
+            return Objects.equals( this.artifactId, that.artifactId )
+                && Objects.equals( this.groupId, that.groupId )
+                && Objects.equals( this.version, that.version )
+                && Objects.equals( this.localRepo, that.localRepo )
+                && Objects.equals( this.workspace, that.workspace )
                 && RepositoryUtils.repositoriesEquals( this.repositories, that.repositories );
         }
 
@@ -211,11 +213,6 @@ public class DefaultPluginDescriptorCache
             return obj != null ? obj.hashCode() : 0;
         }
 
-        private static <T> boolean eq( T s1, T s2 )
-        {
-            return Objects.equals(s1, s2);
-        }
-
     }
 
 }
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 17bf836..ceb39e2 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
@@ -1056,13 +1056,9 @@ public class MavenProject
 
         MavenProject that = (MavenProject) other;
 
-        return eq( getArtifactId(), that.getArtifactId() ) && eq( getGroupId(), that.getGroupId() )
-            && eq( getVersion(), that.getVersion() );
-    }
-
-    private static <T> boolean eq( T s1, T s2 )
-    {
-        return Objects.equals(s1, s2);
+        return Objects.equals( getArtifactId(), that.getArtifactId() )
+            && Objects.equals( getGroupId(), that.getGroupId() )
+            && Objects.equals( getVersion(), that.getVersion() );
     }
 
     @Override
diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
index 0b9c577..6f2eb08 100644
--- a/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
+++ b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
@@ -133,13 +133,13 @@ public class DefaultMavenMetadataCache
             return true;
         }
 
-        return eq( a1.getGroupId(), a2.getGroupId() )
-            && eq( a1.getArtifactId(), a2.getArtifactId() )
-            && eq( a1.getType(), a2.getType() )
-            && eq( a1.getVersion(), a2.getVersion() )
-            && eq( a1.getClassifier(), a2.getClassifier() )
-            && eq( a1.getScope(), a2.getScope() )
-            && eq( a1.getDependencyFilter(), a2.getDependencyFilter() )
+        return Objects.equals( a1.getGroupId(), a2.getGroupId() )
+            && Objects.equals( a1.getArtifactId(), a2.getArtifactId() )
+            && Objects.equals( a1.getType(), a2.getType() )
+            && Objects.equals( a1.getVersion(), a2.getVersion() )
+            && Objects.equals( a1.getClassifier(), a2.getClassifier() )
+            && Objects.equals( a1.getScope(), a2.getScope() )
+            && Objects.equals( a1.getDependencyFilter(), a2.getDependencyFilter() )
             && a1.isOptional() == a2.isOptional();
     }
 
@@ -167,7 +167,8 @@ public class DefaultMavenMetadataCache
             return true;
         }
 
-        return eq( r1.getId(), r2.getId() ) && eq( r1.getUrl(), r2.getUrl() )
+        return Objects.equals( r1.getId(), r2.getId() )
+            && Objects.equals( r1.getUrl(), r2.getUrl() )
             && repositoryPolicyEquals( r1.getReleases(), r2.getReleases() )
             && repositoryPolicyEquals( r1.getSnapshots(), r2.getSnapshots() );
     }
@@ -179,7 +180,7 @@ public class DefaultMavenMetadataCache
             return true;
         }
 
-        return p1.isEnabled() == p2.isEnabled() && eq( p1.getUpdatePolicy(), p2.getUpdatePolicy() );
+        return p1.isEnabled() == p2.isEnabled() && Objects.equals( p1.getUpdatePolicy(), p2.getUpdatePolicy() );
     }
 
     private static boolean repositoriesEquals( List<ArtifactRepository> r1, List<ArtifactRepository> r2 )
@@ -200,11 +201,6 @@ public class DefaultMavenMetadataCache
         return true;
     }
 
-    private static <T> boolean eq( T s1, T s2 )
-    {
-        return Objects.equals(s1, s2);
-    }
-
     /**
      * CacheRecord
      */
diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java b/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java
index a32f87e..37823db 100644
--- a/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java
+++ b/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java
@@ -138,7 +138,7 @@ public abstract class DefaultToolchain // should have been AbstractToolchain...
 
         DefaultToolchain other = (DefaultToolchain) obj;
 
-        if (!Objects.equals(type, other.type))
+        if ( !Objects.equals( type, other.type ) )
         {
             return false;
         }
@@ -146,12 +146,7 @@ public abstract class DefaultToolchain // should have been AbstractToolchain...
         Properties thisProvides = this.getModel().getProvides();
         Properties otherProvides = other.getModel().getProvides();
 
-        if (!Objects.equals(thisProvides, otherProvides))
-        {
-            return false;
-        }
-
-        return true;
+        return Objects.equals( thisProvides, otherProvides );
     }
 
     @Override