[MNG-7288] Remove redundant local variables

Closes #569
This commit is contained in:
Arturo Bernal 2021-10-07 20:45:10 +02:00 committed by Sylwester Lachiewicz
parent b9fb762215
commit d61fcf7da1
14 changed files with 18 additions and 46 deletions

View File

@ -103,12 +103,10 @@ public final class ModelUtils
if ( ( childPlugin != null ) && !assembledPlugins.contains( childPlugin ) )
{
Plugin assembledPlugin = childPlugin;
mergePluginDefinitions( childPlugin, parentPlugin, handleAsInheritance );
// fix for MNG-2221 (assembly cache was not being populated for later reference):
assembledPlugins.add( assembledPlugin );
assembledPlugins.add( childPlugin );
}
// if we're processing this as an inheritance-based merge, and

View File

@ -833,12 +833,8 @@ public class LegacyRepositorySystem
{
repositoryLayout = layouts.get( "default" );
}
ArtifactRepository artifactRepository =
artifactRepositoryFactory.createArtifactRepository( repositoryId, url, repositoryLayout, snapshots,
releases );
return artifactRepository;
return artifactRepositoryFactory.createArtifactRepository( repositoryId, url, repositoryLayout, snapshots,
releases );
}
private static String getMessage( Throwable error, String def )

View File

@ -132,12 +132,11 @@ public class DefaultGraphConflictResolver
res.addEdge( sourceV, newV, edge );
}
}
MetadataGraph linkedRes = findLinkedSubgraph( res );
// System.err.println("Original graph("+graph.getVertices().size()+"):\n"+graph.toString());
// System.err.println("Cleaned("+requestedScope+") graph("+res.getVertices().size()+"):\n"+res.toString());
// System.err.println("Linked("+requestedScope+")
// subgraph("+linkedRes.getVertices().size()+"):\n"+linkedRes.toString());
return linkedRes;
return findLinkedSubgraph( res );
}
catch ( MetadataResolutionException e )
{

View File

@ -324,14 +324,12 @@ public class RepositoryUtils
exclusions.add( toExclusion( exclusion ) );
}
Dependency result = new Dependency( artifact,
return new Dependency( artifact,
dependency.getScope(),
dependency.getOptional() != null
? dependency.isOptional()
: null,
exclusions );
return result;
}
private static Exclusion toExclusion( org.apache.maven.model.Exclusion exclusion )

View File

@ -50,9 +50,7 @@ public class DefaultMetadataReader
{
Objects.requireNonNull( input, "input cannot be null" );
Metadata metadata = read( ReaderFactory.newXmlReader( input ), options );
return metadata;
return read( ReaderFactory.newXmlReader( input ), options );
}
public Metadata read( Reader input, Map<String, ?> options )

View File

@ -323,9 +323,7 @@ public class MavenRepositorySystem
private ArtifactRepositoryLayout getLayout( String id )
{
ArtifactRepositoryLayout layout = layouts.get( id );
return layout;
return layouts.get( id );
}

View File

@ -100,10 +100,8 @@ public class DependencyContext
public boolean isResolutionRequiredForAggregatedProjects( Collection<String> scopesToCollect,
Collection<String> scopesToResolve )
{
boolean required =
scopesToCollectForAggregatedProjects.addAll( scopesToCollect )
|| scopesToResolveForAggregatedProjects.addAll( scopesToResolve );
return required;
return scopesToCollectForAggregatedProjects.addAll( scopesToCollect )
|| scopesToResolveForAggregatedProjects.addAll( scopesToResolve );
}
public void synchronizeWithProjectState()

View File

@ -271,9 +271,7 @@ public class DefaultMavenPluginManager
{
Reader reader = ReaderFactory.newXmlReader( is );
PluginDescriptor pluginDescriptor = builder.build( reader, descriptorLocation );
return pluginDescriptor;
return builder.build( reader, descriptorLocation );
}
catch ( IOException | PlexusConfigurationException e )
{

View File

@ -54,11 +54,9 @@ public class DefaultMavenProjectHelper
public void attachArtifact( MavenProject project, String artifactType, String artifactClassifier,
File artifactFile )
{
String type = artifactType;
ArtifactHandler handler = null;
if ( type != null )
if ( artifactType != null )
{
handler = artifactHandlerManager.getArtifactHandler( artifactType );
}

View File

@ -355,9 +355,7 @@ public class MavenMetadataSource
dependency.getType(), dependency.getClassifier(), effectiveScope,
dependency.isOptional() );
ArtifactFilter dependencyFilter = inheritedFilter;
if ( dependencyFilter != null && !dependencyFilter.include( dependencyArtifact ) )
if ( inheritedFilter != null && !inheritedFilter.include( dependencyArtifact ) )
{
return null;
}
@ -367,7 +365,7 @@ public class MavenMetadataSource
dependencyArtifact.setFile( new File( dependency.getSystemPath() ) );
}
dependencyArtifact.setDependencyFilter( createDependencyFilter( dependency, dependencyFilter ) );
dependencyArtifact.setDependencyFilter( createDependencyFilter( dependency, inheritedFilter ) );
return dependencyArtifact;
}

View File

@ -139,8 +139,7 @@ public class BootstrapCoreExtensionManager
pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
root.accept( nlg );
List<Artifact> artifacts = nlg.getArtifacts( false );
return artifacts;
return nlg.getArtifacts( false );
}
}

View File

@ -124,13 +124,11 @@ public class ArtifactDescriptorReaderDelegate
exclusions.add( convert( exclusion ) );
}
Dependency result = new Dependency( artifact, dependency.getScope(),
return new Dependency( artifact, dependency.getScope(),
dependency.getOptional() != null
? dependency.isOptional()
: null,
exclusions );
return result;
}
private Exclusion convert( org.apache.maven.model.Exclusion exclusion )

View File

@ -51,9 +51,7 @@ public class DefaultSettingsReader
{
Objects.requireNonNull( input, "input cannot be null" );
Settings settings = read( ReaderFactory.newXmlReader( input ), options );
return settings;
return read( ReaderFactory.newXmlReader( input ), options );
}
@Override

View File

@ -167,16 +167,14 @@ public class DefaultDownloader
private String calculateUserAgent()
{
String appVersion = applicationVersion;
String javaVendor = System.getProperty( "java.vendor" );
String javaVersion = System.getProperty( "java.version" );
String javaVendorVersion = System.getProperty( "java.vm.version" );
String osName = System.getProperty( "os.name" );
String osVersion = System.getProperty( "os.version" );
String osArch = System.getProperty( "os.arch" );
return String.format( "%s/%s (%s;%s;%s) (%s;%s;%s)", applicationName, appVersion, osName, osVersion, osArch,
javaVendor, javaVersion, javaVendorVersion );
return String.format( "%s/%s (%s;%s;%s) (%s;%s;%s)", applicationName, applicationVersion, osName, osVersion,
osArch, javaVendor, javaVersion, javaVendorVersion );
}
private static class SystemPropertiesProxyAuthenticator