Code cleanup - Various code simplifications (tests, loops, …)

This commit is contained in:
Arnaud Héritier 2013-06-11 22:09:51 +02:00
parent 87a5532eb9
commit 9e5183f0ad
11 changed files with 14 additions and 52 deletions

View File

@ -170,12 +170,8 @@ public class Restriction
return false;
}
if ( upperBoundInclusive != restriction.upperBoundInclusive )
{
return false;
}
return upperBoundInclusive == restriction.upperBoundInclusive;
return true;
}
public String toString()

View File

@ -122,14 +122,7 @@ public class DefaultRepositoryMetadataManager
+ ") in favor of local copy" );
}
}
else if ( updateCheckManager.isUpdateRequired( metadata, repository, file ) )
{
update = true;
}
else
{
update = false;
}
else update = updateCheckManager.isUpdateRequired( metadata, repository, file );
if ( update )
{

View File

@ -288,7 +288,6 @@ public class StringSearchModelInterpolator
+ cls.getName()
+ "; it is an unmodifiable collection." );
}
continue;
}
}
}

View File

@ -80,7 +80,7 @@ public class MetadataGraphNode
return metadata == null;
}
return metadata == null ? false : metadata.toString().equals( node2.metadata.toString() );
return metadata != null && metadata.toString().equals( node2.metadata.toString() );
}
else
{

View File

@ -68,7 +68,7 @@ public class DefaultArtifactResolverTest
// we want to see all top-level thread groups
ThreadGroup tg = Thread.currentThread().getThreadGroup();
while ( !( tg.getParent() != null ) )
while ( tg.getParent() == null )
{
tg = tg.getParent();
}

View File

@ -54,12 +54,8 @@ public class ExclusionSetFilter
id = artifact.getGroupId() + ':' + id;
if ( excludes.contains( id ) )
{
return false;
}
return !excludes.contains( id );
return true;
}
@Override

View File

@ -92,13 +92,8 @@ public class DependencyContext
public boolean isResolutionRequiredForCurrentProject()
{
if ( lastDependencyArtifacts != project.getDependencyArtifacts()
|| ( lastDependencyArtifacts != null && lastDependencyArtifactCount != lastDependencyArtifacts.size() ) )
{
return true;
}
return false;
return lastDependencyArtifacts != project.getDependencyArtifacts() || ( lastDependencyArtifacts != null
&& lastDependencyArtifactCount != lastDependencyArtifacts.size() );
}
public boolean isResolutionRequiredForAggregatedProjects( Collection<String> scopesToCollect,

View File

@ -196,7 +196,6 @@ public class DefaultPluginVersionResolver
}
catch ( InvalidVersionSpecificationException e )
{
continue;
}
}

View File

@ -734,12 +734,8 @@ public class MavenMetadataSource
{
return true;
}
if ( e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException
&& e.getCause().getCause() instanceof ArtifactNotFoundException )
{
return true;
}
return false;
return e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException
&& e.getCause().getCause() instanceof ArtifactNotFoundException;
}
private boolean isNonTransferrablePom( Exception e )
@ -748,12 +744,8 @@ public class MavenMetadataSource
{
return true;
}
if ( e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException
&& !( e.getCause().getCause() instanceof ArtifactNotFoundException ) )
{
return true;
}
return false;
return e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException
&& !( e.getCause().getCause() instanceof ArtifactNotFoundException );
}
private Properties getSystemProperties()

View File

@ -781,13 +781,9 @@ public class DefaultModelValidator
return false;
}
if ( !validateBannedCharacters( fieldName, problems, severity, version, string, sourceHint, tracker,
ILLEGAL_VERSION_CHARS ) )
{
return false;
}
return validateBannedCharacters( fieldName, problems, severity, version, string, sourceHint, tracker,
ILLEGAL_VERSION_CHARS );
return true;
}
private boolean validate20ProperSnapshotVersion( String fieldName, ModelProblemCollector problems, Severity severity, Version version,

View File

@ -545,12 +545,8 @@ public class MojoDescriptor
return false;
}
if ( !compareObjects( getGoal(), other.getGoal() ) )
{
return false;
}
return compareObjects( getGoal(), other.getGoal() );
return true;
}
return false;