mirror of https://github.com/apache/maven.git
[MNG-6492] - Minor improvement on Array construction, conversion performance
This commit is contained in:
parent
e4b53d3f2c
commit
ba74b96633
|
@ -313,12 +313,8 @@ public final class ModelUtils
|
||||||
|
|
||||||
public static List<Repository> mergeRepositoryLists( List<Repository> dominant, List<Repository> recessive )
|
public static List<Repository> mergeRepositoryLists( List<Repository> dominant, List<Repository> recessive )
|
||||||
{
|
{
|
||||||
List<Repository> repositories = new ArrayList<>();
|
|
||||||
|
|
||||||
for ( Repository repository : dominant )
|
List<Repository> repositories = new ArrayList<>( dominant );
|
||||||
{
|
|
||||||
repositories.add( repository );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( Repository repository : recessive )
|
for ( Repository repository : recessive )
|
||||||
{
|
{
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class DefaultClasspathTransformation
|
||||||
|
|
||||||
if ( exits != null && exits.size() > 0 )
|
if ( exits != null && exits.size() > 0 )
|
||||||
{
|
{
|
||||||
MetadataGraphEdge[] sortedExits = exits.toArray( new MetadataGraphEdge[exits.size()] );
|
MetadataGraphEdge[] sortedExits = exits.toArray( new MetadataGraphEdge[0] );
|
||||||
Arrays.sort( sortedExits
|
Arrays.sort( sortedExits
|
||||||
,
|
,
|
||||||
new Comparator<MetadataGraphEdge>()
|
new Comparator<MetadataGraphEdge>()
|
||||||
|
|
|
@ -49,6 +49,7 @@ import org.eclipse.aether.resolution.VersionRangeRequest;
|
||||||
import org.eclipse.aether.resolution.VersionRangeResolutionException;
|
import org.eclipse.aether.resolution.VersionRangeResolutionException;
|
||||||
import org.eclipse.aether.resolution.VersionRangeResult;
|
import org.eclipse.aether.resolution.VersionRangeResult;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A model resolver to assist building of projects. This resolver gives priority to those repositories that have been
|
* A model resolver to assist building of projects. This resolver gives priority to those repositories that have been
|
||||||
* declared in the POM.
|
* declared in the POM.
|
||||||
|
@ -91,9 +92,7 @@ public class ProjectModelResolver
|
||||||
this.resolver = resolver;
|
this.resolver = resolver;
|
||||||
this.remoteRepositoryManager = remoteRepositoryManager;
|
this.remoteRepositoryManager = remoteRepositoryManager;
|
||||||
this.pomRepositories = new ArrayList<>();
|
this.pomRepositories = new ArrayList<>();
|
||||||
List<RemoteRepository> externalRepositories = new ArrayList<>();
|
this.externalRepositories = Collections.unmodifiableList( new ArrayList<>( repositories ) );
|
||||||
externalRepositories.addAll( repositories );
|
|
||||||
this.externalRepositories = Collections.unmodifiableList( externalRepositories );
|
|
||||||
this.repositories = new ArrayList<>();
|
this.repositories = new ArrayList<>();
|
||||||
this.repositories.addAll( externalRepositories );
|
this.repositories.addAll( externalRepositories );
|
||||||
this.repositoryMerging = repositoryMerging;
|
this.repositoryMerging = repositoryMerging;
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class DefaultToolchainManagerPrivate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return toRet.toArray( new ToolchainPrivate[toRet.size()] );
|
return toRet.toArray( new ToolchainPrivate[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,10 +50,7 @@ public class MojoExecutorStub
|
||||||
public void execute( MavenSession session, List<MojoExecution> mojoExecutions, ProjectIndex projectIndex )
|
public void execute( MavenSession session, List<MojoExecution> mojoExecutions, ProjectIndex projectIndex )
|
||||||
throws LifecycleExecutionException
|
throws LifecycleExecutionException
|
||||||
{
|
{
|
||||||
for ( MojoExecution mojoExecution : mojoExecutions )
|
executions.addAll(mojoExecutions);
|
||||||
{
|
|
||||||
executions.add( mojoExecution );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class CleanArgument
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cleanArgs = cleaned.toArray( new String[cleanedSz] );
|
cleanArgs = cleaned.toArray( new String[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return cleanArgs;
|
return cleanArgs;
|
||||||
|
|
|
@ -384,7 +384,7 @@ public class MavenCli
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mavenConfig = cliManager.parse( args.toArray( new String[args.size()] ) );
|
mavenConfig = cliManager.parse( args.toArray( new String[0] ) );
|
||||||
List<?> unrecongized = mavenConfig.getArgList();
|
List<?> unrecongized = mavenConfig.getArgList();
|
||||||
if ( !unrecongized.isEmpty() )
|
if ( !unrecongized.isEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -1196,7 +1196,7 @@ public class MavenCli
|
||||||
sb.append( String.format( "%s\n", configurationProcessor.getClass().getName() ) );
|
sb.append( String.format( "%s\n", configurationProcessor.getClass().getName() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.append( String.format( "\n" ) );
|
sb.append( "\n" );
|
||||||
throw new Exception( sb.toString() );
|
throw new Exception( sb.toString() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,9 +263,8 @@ public class StringSearchModelInterpolator
|
||||||
fields.add( new ObjectField( currentField ) );
|
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.versionRangeResolver = versionRangeResolver;
|
||||||
this.remoteRepositoryManager = remoteRepositoryManager;
|
this.remoteRepositoryManager = remoteRepositoryManager;
|
||||||
this.repositories = repositories;
|
this.repositories = repositories;
|
||||||
List<RemoteRepository> externalRepositories = new ArrayList<>();
|
this.externalRepositories = Collections.unmodifiableList( new ArrayList<>( repositories ) );
|
||||||
externalRepositories.addAll( repositories );
|
|
||||||
this.externalRepositories = Collections.unmodifiableList( externalRepositories );
|
|
||||||
|
|
||||||
this.repositoryIds = new HashSet<>();
|
this.repositoryIds = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue