Skip to content

Commit

Permalink
Removal of not needed calls to toString() in the code base
Browse files Browse the repository at this point in the history
Fixes #466
 o Removed not needed calls to toString() to improve the code base
  • Loading branch information
obfischer committed Jun 30, 2021
1 parent 5ea67ba commit 4293365
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void render()
try
{
pw = new PrintWriter( outputFileName, "UTF8" );
pw.print( sb.toString() );
pw.print( sb );
pw.close();
}
catch ( IOException e )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ private void logUpdates( Map<Dependency, ArtifactVersions> updates, String secti
latest = null;
}
}
String right = " " + ( latest == null ? current : current + " -> " + latest.toString() );
String right = " " + ( latest == null ? current : current + " -> " + latest );
List<String> t = latest == null ? usingCurrent : withUpdates;
if ( right.length() + left.length() + 3 > INFO_PAD_SIZE )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void execute()
buf.append( ' ' );
buf.append( currentVersion );
buf.append( " -> " );
buf.append( artifactVersion.toString() );
buf.append( artifactVersion );
logLine( false, buf.toString() );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private void lockParentSnapshot( ModifiedPomXMLEventReader pom, MavenProject par
{
if ( PomHelper.setProjectParentVersion( pom, lockedParentVersion ) )
{
getLog().info( "Locked parent " + parentArtifact.toString() + " to version "
getLog().info( "Locked parent " + parentArtifact + " to version "
+ lockedParentVersion );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void render()
try
{
pw = new PrintWriter( outputFileName, "UTF8" );
pw.print( sb.toString() );
pw.print( sb );
pw.close();
}
catch ( IOException e )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private void unlockParentSnapshot( ModifiedPomXMLEventReader pom, MavenProject p
String unlockedParentVersion = versionMatcher.replaceFirst( "-SNAPSHOT" );
if ( PomHelper.setProjectParentVersion( pom, unlockedParentVersion ) )
{
getLog().info( "Unlocked parent " + parentArtifact.toString() + " to version "
getLog().info( "Unlocked parent " + parentArtifact + " to version "
+ unlockedParentVersion );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected void update( ModifiedPomXMLEventReader pom )

if ( PomHelper.setProjectParentVersion( pom, artifactVersion.toString() ) )
{
getLog().debug( "Made an update from " + currentVersion + " to " + artifactVersion.toString() );
getLog().debug( "Made an update from " + currentVersion + " to " + artifactVersion );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void useLatestReleases( ModifiedPomXMLEventReader pom, Collection<Depend
}

ArtifactVersion selectedVersion = new DefaultArtifactVersion( version );
getLog().debug( "Selected version:" + selectedVersion.toString() );
getLog().debug( "Selected version: " + selectedVersion );

getLog().debug( "Looking for newer versions of " + toString( dep ) );
ArtifactVersions versions = getHelper().lookupArtifactVersions( artifact, false );
Expand All @@ -172,9 +172,9 @@ private void useLatestReleases( ModifiedPomXMLEventReader pom, Collection<Depend
{
if ( artifact.getId().equals( getProject().getParentArtifact().getId() ) && isProcessingParent() )
{
if ( PomHelper.setProjectParentVersion( pom, newVersion.toString() ) )
if ( PomHelper.setProjectParentVersion( pom, newVersion ) )
{
getLog().debug( "Made parent update from " + version + " to " + newVersion.toString() );
getLog().debug( "Made parent update from " + version + " to " + newVersion );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private void useLatestSnapshots( ModifiedPomXMLEventReader pom, Collection<Depen
snapshotsOnly.add( artifactVersion );
}
}
getLog().debug("Snapshot Only versions " + snapshotsOnly);
getLog().debug( "Snapshot Only versions " + snapshotsOnly );

ArtifactVersion[] filteredVersions = majorMinorIncfilter.filter( selectedVersion,
(ArtifactVersion[]) snapshotsOnly.toArray(
Expand All @@ -200,7 +200,7 @@ private void useLatestSnapshots( ModifiedPomXMLEventReader pom, Collection<Depen
{
if ( PomHelper.setProjectParentVersion( pom, latestVersion ) )
{
getLog().debug( "Made parent update from " + version + " to " + latestVersion.toString() );
getLog().debug( "Made parent update from " + version + " to " + latestVersion );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private void useLatestVersions( ModifiedPomXMLEventReader pom, Collection<Depend
}

ArtifactVersion selectedVersion = new DefaultArtifactVersion( version );
getLog().debug( "Selected version:" + selectedVersion.toString() );
getLog().debug( "Selected version:" + selectedVersion );

getLog().debug( "Looking for newer versions of " + toString( dep ) );
ArtifactVersions versions = getHelper().lookupArtifactVersions( artifact, false );
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/codehaus/mojo/versions/UseReleasesMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ else if ( failIfNotReplaced )
{
if ( PomHelper.setProjectParentVersion( pom, finalVersion.toString() ) )
{
getLog().info( "Updated " + toString( project ) + " to version " + finalVersion.toString() );
getLog().info( "Updated " + toString( project ) + " to version " + finalVersion );
}
}
else
Expand Down Expand Up @@ -255,7 +255,7 @@ private void rangeMatching( ModifiedPomXMLEventReader pom, Dependency dep, Strin
if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version,
finalVersion.toString(), getProject().getModel() ) )
{
getLog().info( "Updated " + toString( dep ) + " to version " + finalVersion.toString() );
getLog().info( "Updated " + toString( dep ) + " to version " + finalVersion );
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void assertLater(String version, VersionComparator instance) {
int count = instance.getSegmentCount( v1 );
for (int i = 0; i < count; i++) {
ArtifactVersion v2 = instance.incrementSegment( v1, i );
assertTrue(v1.toString() + " < " + v2.toString(), instance.compare( v1, v2 ) < 0);
assertTrue(v1 + " < " + v2, instance.compare(v1, v2 ) < 0);
}
}
}

0 comments on commit 4293365

Please sign in to comment.