Fix checkstyle reported errors

This commit is contained in:
rfscholte 2019-09-10 18:51:18 +02:00
parent d09bc7437f
commit 38efe8444c
9 changed files with 26 additions and 50 deletions

View File

@ -593,11 +593,8 @@ public class VersionRange
} }
VersionRange other = (VersionRange) obj; VersionRange other = (VersionRange) obj;
boolean equals = return Objects.equals( recommendedVersion, other.recommendedVersion )
Objects.equals(recommendedVersion, other.recommendedVersion); && Objects.equals( restrictions, other.restrictions );
equals &=
Objects.equals(restrictions, other.restrictions);
return equals;
} }
public int hashCode() public int hashCode()

View File

@ -69,12 +69,7 @@ public class ScopeArtifactFilter
ScopeArtifactFilter other = (ScopeArtifactFilter) obj; ScopeArtifactFilter other = (ScopeArtifactFilter) obj;
return equals( scope, other.scope ); return Objects.equals( scope, other.scope );
}
private static <T> boolean equals( T str1, T str2 )
{
return Objects.equals(str1, str2);
} }
} }

View File

@ -194,9 +194,11 @@ public class DefaultPluginDescriptorCache
CacheKey that = (CacheKey) obj; CacheKey that = (CacheKey) obj;
return eq( this.artifactId, that.artifactId ) && eq( this.groupId, that.groupId ) return Objects.equals( this.artifactId, that.artifactId )
&& eq( this.version, that.version ) && eq( this.localRepo, that.localRepo ) && Objects.equals( this.groupId, that.groupId )
&& eq( this.workspace, that.workspace ) && Objects.equals( this.version, that.version )
&& Objects.equals( this.localRepo, that.localRepo )
&& Objects.equals( this.workspace, that.workspace )
&& RepositoryUtils.repositoriesEquals( this.repositories, that.repositories ); && RepositoryUtils.repositoriesEquals( this.repositories, that.repositories );
} }
@ -211,11 +213,6 @@ public class DefaultPluginDescriptorCache
return obj != null ? obj.hashCode() : 0; return obj != null ? obj.hashCode() : 0;
} }
private static <T> boolean eq( T s1, T s2 )
{
return Objects.equals(s1, s2);
}
} }
} }

View File

@ -1056,13 +1056,9 @@ public class MavenProject
MavenProject that = (MavenProject) other; MavenProject that = (MavenProject) other;
return eq( getArtifactId(), that.getArtifactId() ) && eq( getGroupId(), that.getGroupId() ) return Objects.equals( getArtifactId(), that.getArtifactId() )
&& eq( getVersion(), that.getVersion() ); && Objects.equals( getGroupId(), that.getGroupId() )
} && Objects.equals( getVersion(), that.getVersion() );
private static <T> boolean eq( T s1, T s2 )
{
return Objects.equals(s1, s2);
} }
@Override @Override

View File

@ -133,13 +133,13 @@ public class DefaultMavenMetadataCache
return true; return true;
} }
return eq( a1.getGroupId(), a2.getGroupId() ) return Objects.equals( a1.getGroupId(), a2.getGroupId() )
&& eq( a1.getArtifactId(), a2.getArtifactId() ) && Objects.equals( a1.getArtifactId(), a2.getArtifactId() )
&& eq( a1.getType(), a2.getType() ) && Objects.equals( a1.getType(), a2.getType() )
&& eq( a1.getVersion(), a2.getVersion() ) && Objects.equals( a1.getVersion(), a2.getVersion() )
&& eq( a1.getClassifier(), a2.getClassifier() ) && Objects.equals( a1.getClassifier(), a2.getClassifier() )
&& eq( a1.getScope(), a2.getScope() ) && Objects.equals( a1.getScope(), a2.getScope() )
&& eq( a1.getDependencyFilter(), a2.getDependencyFilter() ) && Objects.equals( a1.getDependencyFilter(), a2.getDependencyFilter() )
&& a1.isOptional() == a2.isOptional(); && a1.isOptional() == a2.isOptional();
} }
@ -167,7 +167,8 @@ public class DefaultMavenMetadataCache
return true; 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.getReleases(), r2.getReleases() )
&& repositoryPolicyEquals( r1.getSnapshots(), r2.getSnapshots() ); && repositoryPolicyEquals( r1.getSnapshots(), r2.getSnapshots() );
} }
@ -179,7 +180,7 @@ public class DefaultMavenMetadataCache
return true; 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 ) private static boolean repositoriesEquals( List<ArtifactRepository> r1, List<ArtifactRepository> r2 )
@ -200,11 +201,6 @@ public class DefaultMavenMetadataCache
return true; return true;
} }
private static <T> boolean eq( T s1, T s2 )
{
return Objects.equals(s1, s2);
}
/** /**
* CacheRecord * CacheRecord
*/ */

View File

@ -146,12 +146,7 @@ public abstract class DefaultToolchain // should have been AbstractToolchain...
Properties thisProvides = this.getModel().getProvides(); Properties thisProvides = this.getModel().getProvides();
Properties otherProvides = other.getModel().getProvides(); Properties otherProvides = other.getModel().getProvides();
if (!Objects.equals(thisProvides, otherProvides)) return Objects.equals( thisProvides, otherProvides );
{
return false;
}
return true;
} }
@Override @Override