mirror of
https://github.com/apache/maven.git
synced 2025-03-06 16:49:27 +00:00
[MNG-6492] - Minor improvement on Array construction, conversion performance
This commit is contained in:
parent
e4b53d3f2c
commit
ba74b96633
@ -313,12 +313,8 @@ private static void mergePluginExecutionDefinitions( PluginExecution child, Plug
|
||||
|
||||
public static List<Repository> mergeRepositoryLists( List<Repository> dominant, List<Repository> recessive )
|
||||
{
|
||||
List<Repository> repositories = new ArrayList<>();
|
||||
|
||||
for ( Repository repository : dominant )
|
||||
{
|
||||
repositories.add( repository );
|
||||
}
|
||||
List<Repository> repositories = new ArrayList<>( dominant );
|
||||
|
||||
for ( Repository repository : recessive )
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ protected void visit( MetadataGraphVertex node ) // , String version, String art
|
||||
|
||||
if ( exits != null && exits.size() > 0 )
|
||||
{
|
||||
MetadataGraphEdge[] sortedExits = exits.toArray( new MetadataGraphEdge[exits.size()] );
|
||||
MetadataGraphEdge[] sortedExits = exits.toArray( new MetadataGraphEdge[0] );
|
||||
Arrays.sort( sortedExits
|
||||
,
|
||||
new Comparator<MetadataGraphEdge>()
|
||||
|
@ -49,6 +49,7 @@
|
||||
import org.eclipse.aether.resolution.VersionRangeResolutionException;
|
||||
import org.eclipse.aether.resolution.VersionRangeResult;
|
||||
|
||||
|
||||
/**
|
||||
* A model resolver to assist building of projects. This resolver gives priority to those repositories that have been
|
||||
* declared in the POM.
|
||||
@ -91,9 +92,7 @@ public ProjectModelResolver( RepositorySystemSession session, RequestTrace trace
|
||||
this.resolver = resolver;
|
||||
this.remoteRepositoryManager = remoteRepositoryManager;
|
||||
this.pomRepositories = new ArrayList<>();
|
||||
List<RemoteRepository> externalRepositories = new ArrayList<>();
|
||||
externalRepositories.addAll( repositories );
|
||||
this.externalRepositories = Collections.unmodifiableList( externalRepositories );
|
||||
this.externalRepositories = Collections.unmodifiableList( new ArrayList<>( repositories ) );
|
||||
this.repositories = new ArrayList<>();
|
||||
this.repositories.addAll( externalRepositories );
|
||||
this.repositoryMerging = repositoryMerging;
|
||||
|
@ -69,7 +69,7 @@ public ToolchainPrivate[] getToolchainsForType( String type, MavenSession contex
|
||||
}
|
||||
}
|
||||
|
||||
return toRet.toArray( new ToolchainPrivate[toRet.size()] );
|
||||
return toRet.toArray( new ToolchainPrivate[0] );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,10 +50,7 @@ public void execute( MavenSession session, MojoExecution mojoExecution, ProjectI
|
||||
public void execute( MavenSession session, List<MojoExecution> mojoExecutions, ProjectIndex projectIndex )
|
||||
throws LifecycleExecutionException
|
||||
{
|
||||
for ( MojoExecution mojoExecution : mojoExecutions )
|
||||
{
|
||||
executions.add( mojoExecution );
|
||||
}
|
||||
executions.addAll(mojoExecutions);
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,7 +115,7 @@ public static String[] cleanArgs( String[] args )
|
||||
}
|
||||
else
|
||||
{
|
||||
cleanArgs = cleaned.toArray( new String[cleanedSz] );
|
||||
cleanArgs = cleaned.toArray( new String[0] );
|
||||
}
|
||||
|
||||
return cleanArgs;
|
||||
|
@ -384,7 +384,7 @@ void cli( CliRequest cliRequest )
|
||||
}
|
||||
}
|
||||
|
||||
mavenConfig = cliManager.parse( args.toArray( new String[args.size()] ) );
|
||||
mavenConfig = cliManager.parse( args.toArray( new String[0] ) );
|
||||
List<?> unrecongized = mavenConfig.getArgList();
|
||||
if ( !unrecongized.isEmpty() )
|
||||
{
|
||||
@ -1196,7 +1196,7 @@ else if ( userSuppliedConfigurationProcessorCount > 1 )
|
||||
sb.append( String.format( "%s\n", configurationProcessor.getClass().getName() ) );
|
||||
}
|
||||
}
|
||||
sb.append( String.format( "\n" ) );
|
||||
sb.append( "\n" );
|
||||
throw new Exception( sb.toString() );
|
||||
}
|
||||
}
|
||||
|
@ -263,9 +263,8 @@ else if ( Map.class.isAssignableFrom( type ) )
|
||||
fields.add( new ObjectField( currentField ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
this.fields = fields.toArray( new CacheField[fields.size()] );
|
||||
this.fields = fields.toArray( new CacheField[0] );
|
||||
|
||||
}
|
||||
|
||||
|
@ -89,9 +89,7 @@ class DefaultModelResolver
|
||||
this.versionRangeResolver = versionRangeResolver;
|
||||
this.remoteRepositoryManager = remoteRepositoryManager;
|
||||
this.repositories = repositories;
|
||||
List<RemoteRepository> externalRepositories = new ArrayList<>();
|
||||
externalRepositories.addAll( repositories );
|
||||
this.externalRepositories = Collections.unmodifiableList( externalRepositories );
|
||||
this.externalRepositories = Collections.unmodifiableList( new ArrayList<>( repositories ) );
|
||||
|
||||
this.repositoryIds = new HashSet<>();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user