mirror of https://github.com/apache/maven.git
[MNG-6847] Explicit type can be replaced by the diamond operator
This closes #315
This commit is contained in:
parent
f620bb714d
commit
39492281b2
|
@ -41,7 +41,7 @@ public class MultipleArtifactsNotFoundException
|
|||
List<Artifact> missingArtifacts,
|
||||
List<ArtifactRepository> remoteRepositories )
|
||||
{
|
||||
this( originatingArtifact, new ArrayList<Artifact>(), missingArtifacts, remoteRepositories );
|
||||
this( originatingArtifact, new ArrayList<>(), missingArtifacts, remoteRepositories );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,10 +37,10 @@ import org.apache.maven.artifact.Artifact;
|
|||
public class VersionRange
|
||||
{
|
||||
private static final Map<String, VersionRange> CACHE_SPEC =
|
||||
Collections.<String, VersionRange>synchronizedMap( new WeakHashMap<String, VersionRange>() );
|
||||
Collections.synchronizedMap( new WeakHashMap<>() );
|
||||
|
||||
private static final Map<String, VersionRange> CACHE_VERSION =
|
||||
Collections.<String, VersionRange>synchronizedMap( new WeakHashMap<String, VersionRange>() );
|
||||
Collections.synchronizedMap( new WeakHashMap<>() );
|
||||
|
||||
private final ArtifactVersion recommendedVersion;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class DefaultProblemCollector
|
|||
|
||||
DefaultProblemCollector( List<Problem> problems )
|
||||
{
|
||||
this.problems = ( problems != null ) ? problems : new ArrayList<Problem>();
|
||||
this.problems = ( problems != null ) ? problems : new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -116,7 +116,7 @@ public class DefaultArtifactResolver
|
|||
else
|
||||
{
|
||||
executor = new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<Runnable>(), new DaemonThreadCreator() );
|
||||
new LinkedBlockingQueue<>(), new DaemonThreadCreator() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class DuplicateProjectException
|
|||
{
|
||||
super( message, (File) null );
|
||||
|
||||
this.collisions = ( collisions != null ) ? collisions : new LinkedHashMap<String, List<File>>();
|
||||
this.collisions = ( collisions != null ) ? collisions : new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,7 +78,7 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
{
|
||||
if ( !groupedToolchains.containsKey( model.getType() ) )
|
||||
{
|
||||
groupedToolchains.put( model.getType(), new ArrayList<ToolchainModel>() );
|
||||
groupedToolchains.put( model.getType(), new ArrayList<>() );
|
||||
}
|
||||
|
||||
groupedToolchains.get( model.getType() ).add( model );
|
||||
|
|
|
@ -41,7 +41,7 @@ public class DefaultMavenExecutionResult
|
|||
private final List<Throwable> exceptions = new CopyOnWriteArrayList<>();
|
||||
|
||||
private final Map<MavenProject, BuildSummary> buildSummaries =
|
||||
Collections.synchronizedMap( new IdentityHashMap<MavenProject, BuildSummary>() );
|
||||
Collections.synchronizedMap( new IdentityHashMap<>() );
|
||||
|
||||
public MavenExecutionResult setProject( MavenProject project )
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ public class DefaultMavenExecutionResult
|
|||
public List<MavenProject> getTopologicallySortedProjects()
|
||||
{
|
||||
return null == topologicallySortedProjects
|
||||
? Collections.<MavenProject>emptyList()
|
||||
? Collections.emptyList()
|
||||
: Collections.unmodifiableList( topologicallySortedProjects );
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class FilteredProjectDependencyGraph
|
|||
this.projectDependencyGraph =
|
||||
Objects.requireNonNull( projectDependencyGraph, "projectDependencyGraph cannot be null" );
|
||||
|
||||
this.whiteList = new IdentityHashMap<MavenProject, Object>();
|
||||
this.whiteList = new IdentityHashMap<>();
|
||||
|
||||
for ( MavenProject project : whiteList )
|
||||
{
|
||||
|
|
|
@ -179,7 +179,7 @@ public class DefaultLifecycleExecutionPlanCalculator
|
|||
|
||||
finalizeMojoConfiguration( mojoExecution );
|
||||
|
||||
calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>() );
|
||||
calculateForkedExecutions( mojoExecution, session, project, new HashSet<>() );
|
||||
}
|
||||
|
||||
public List<MojoExecution> calculateMojoExecutions( MavenSession session, MavenProject project, List<Object> tasks )
|
||||
|
@ -331,7 +331,7 @@ public class DefaultLifecycleExecutionPlanCalculator
|
|||
PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
|
||||
{
|
||||
calculateForkedExecutions( mojoExecution, session, session.getCurrentProject(), new HashSet<MojoDescriptor>() );
|
||||
calculateForkedExecutions( mojoExecution, session, session.getCurrentProject(), new HashSet<>() );
|
||||
}
|
||||
|
||||
private void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session, MavenProject project,
|
||||
|
|
|
@ -62,8 +62,8 @@ public class DependencyContext
|
|||
this.project = project;
|
||||
scopesToCollectForCurrentProject = scopesToCollect;
|
||||
scopesToResolveForCurrentProject = scopesToResolve;
|
||||
scopesToCollectForAggregatedProjects = Collections.synchronizedSet( new TreeSet<String>() );
|
||||
scopesToResolveForAggregatedProjects = Collections.synchronizedSet( new TreeSet<String>() );
|
||||
scopesToCollectForAggregatedProjects = Collections.synchronizedSet( new TreeSet<>() );
|
||||
scopesToResolveForAggregatedProjects = Collections.synchronizedSet( new TreeSet<>() );
|
||||
}
|
||||
|
||||
public MavenProject getProject()
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.apache.maven.lifecycle.internal;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.execution.BuildSuccess;
|
||||
import org.apache.maven.execution.ExecutionEvent;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
|
@ -108,7 +107,7 @@ public class LifecycleModuleBuilder
|
|||
eventCatapult.fire( ExecutionEvent.Type.ProjectStarted, session, null );
|
||||
|
||||
MavenExecutionPlan executionPlan =
|
||||
builderCommon.resolveBuildPlan( session, currentProject, taskSegment, new HashSet<Artifact>() );
|
||||
builderCommon.resolveBuildPlan( session, currentProject, taskSegment, new HashSet<>() );
|
||||
List<MojoExecution> mojoExecutions = executionPlan.getMojoExecutions();
|
||||
|
||||
projectExecutionListener.beforeProjectLifecycleExecution( new ProjectExecutionEvent( session,
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ReactorBuildStatus
|
|||
{
|
||||
private final ProjectDependencyGraph projectDependencyGraph;
|
||||
|
||||
private final Collection<String> blackListedProjects = Collections.synchronizedSet( new HashSet<String>() );
|
||||
private final Collection<String> blackListedProjects = Collections.synchronizedSet( new HashSet<>() );
|
||||
|
||||
private volatile boolean halted = false;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ThreadOutputMuxer
|
|||
|
||||
private final PrintStream defaultPrintStream = new PrintStream( defaultOutputStreamForUnknownData );
|
||||
|
||||
private final Set<ProjectSegment> completedBuilds = Collections.synchronizedSet( new HashSet<ProjectSegment>() );
|
||||
private final Set<ProjectSegment> completedBuilds = Collections.synchronizedSet( new HashSet<>() );
|
||||
|
||||
private volatile ProjectSegment currentBuild;
|
||||
|
||||
|
|
|
@ -185,8 +185,8 @@ public class DefaultProjectBuilder
|
|||
|
||||
modelProblems = result.getProblems();
|
||||
|
||||
initProject( project, Collections.<String, MavenProject>emptyMap(), true,
|
||||
result, new HashMap<File, Boolean>(), projectBuildingRequest );
|
||||
initProject( project, Collections.emptyMap(), true,
|
||||
result, new HashMap<>(), projectBuildingRequest );
|
||||
}
|
||||
else if ( projectBuildingRequest.isResolveDependencies() )
|
||||
{
|
||||
|
@ -374,7 +374,7 @@ public class DefaultProjectBuilder
|
|||
Map<String, MavenProject> projectIndex = new HashMap<>( 256 );
|
||||
|
||||
boolean noErrors =
|
||||
build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<File>(), true, recursive,
|
||||
build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<>(), true, recursive,
|
||||
config );
|
||||
|
||||
populateReactorModelPool( modelPool, interimResults );
|
||||
|
@ -384,8 +384,8 @@ public class DefaultProjectBuilder
|
|||
try
|
||||
{
|
||||
noErrors =
|
||||
build( results, new ArrayList<MavenProject>(), projectIndex, interimResults, request,
|
||||
new HashMap<File, Boolean>(), config.session ) && noErrors;
|
||||
build( results, new ArrayList<>(), projectIndex, interimResults, request,
|
||||
new HashMap<>(), config.session ) && noErrors;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -465,7 +465,7 @@ public class DefaultProjectBuilder
|
|||
try
|
||||
{
|
||||
// first pass: build without building parent.
|
||||
initProject( project, projectIndex, false, result, new HashMap<File, Boolean>( 0 ), config.request );
|
||||
initProject( project, projectIndex, false, result, new HashMap<>( 0 ), config.request );
|
||||
}
|
||||
catch ( InvalidArtifactRTException iarte )
|
||||
{
|
||||
|
|
|
@ -175,7 +175,7 @@ public class MavenProject
|
|||
|
||||
private DependencyFilter extensionDependencyFilter;
|
||||
|
||||
private final Set<String> lifecyclePhases = Collections.synchronizedSet( new LinkedHashSet<String>() );
|
||||
private final Set<String> lifecyclePhases = Collections.synchronizedSet( new LinkedHashSet<>() );
|
||||
|
||||
public MavenProject()
|
||||
{
|
||||
|
|
|
@ -220,14 +220,14 @@ public class DefaultMavenMetadataCache
|
|||
{
|
||||
this.pomArtifact = ArtifactUtils.copyArtifact( pomArtifact );
|
||||
this.relocatedArtifact = ArtifactUtils.copyArtifactSafe( relocatedArtifact );
|
||||
this.artifacts = ArtifactUtils.copyArtifacts( artifacts, new ArrayList<Artifact>() );
|
||||
this.artifacts = ArtifactUtils.copyArtifacts( artifacts, new ArrayList<>() );
|
||||
this.remoteRepositories = new ArrayList<>( remoteRepositories );
|
||||
|
||||
this.managedVersions = managedVersions;
|
||||
if ( managedVersions != null )
|
||||
{
|
||||
this.managedVersions =
|
||||
ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<String, Artifact>() );
|
||||
ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<>() );
|
||||
}
|
||||
|
||||
File pomFile = pomArtifact.getFile();
|
||||
|
@ -310,11 +310,11 @@ public class DefaultMavenMetadataCache
|
|||
Artifact pomArtifact = ArtifactUtils.copyArtifact( cacheRecord.getArtifact() );
|
||||
Artifact relocatedArtifact = ArtifactUtils.copyArtifactSafe( cacheRecord.getRelocatedArtifact() );
|
||||
Set<Artifact> artifacts =
|
||||
ArtifactUtils.copyArtifacts( cacheRecord.getArtifacts(), new LinkedHashSet<Artifact>() );
|
||||
ArtifactUtils.copyArtifacts( cacheRecord.getArtifacts(), new LinkedHashSet<>() );
|
||||
Map<String, Artifact> managedVersions = cacheRecord.getManagedVersions();
|
||||
if ( managedVersions != null )
|
||||
{
|
||||
managedVersions = ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<String, Artifact>() );
|
||||
managedVersions = ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<>() );
|
||||
}
|
||||
return new ResolutionGroup( pomArtifact, relocatedArtifact, artifacts, managedVersions,
|
||||
cacheRecord.getRemoteRepositories() );
|
||||
|
|
|
@ -129,7 +129,7 @@ public class DefaultToolchainManager
|
|||
}
|
||||
}
|
||||
|
||||
return ( context != null ) ? context : new HashMap<String, Object>();
|
||||
return ( context != null ) ? context : new HashMap<>();
|
||||
}
|
||||
|
||||
public static final String getStorageKey( String type )
|
||||
|
|
|
@ -48,7 +48,7 @@ public class DefaultToolchainsBuildingResult
|
|||
public DefaultToolchainsBuildingResult( PersistedToolchains effectiveToolchains, List<Problem> problems )
|
||||
{
|
||||
this.effectiveToolchains = effectiveToolchains;
|
||||
this.problems = ( problems != null ) ? problems : new ArrayList<Problem>();
|
||||
this.problems = ( problems != null ) ? problems : new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -45,7 +45,7 @@ public class BuilderCommonTest
|
|||
final BuilderCommon builderCommon = getBuilderCommon();
|
||||
final MavenExecutionPlan plan =
|
||||
builderCommon.resolveBuildPlan( session1, ProjectDependencyGraphStub.A, taskSegment1,
|
||||
new HashSet<Artifact>() );
|
||||
new HashSet<>() );
|
||||
assertEquals( LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan().size(), plan.size() );
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class CompletionServiceStub
|
|||
implements CompletionService<ProjectSegment>
|
||||
{
|
||||
List<FutureTask<ProjectSegment>> projectBuildFutureTasks =
|
||||
Collections.synchronizedList( new ArrayList<FutureTask<ProjectSegment>>() );
|
||||
Collections.synchronizedList(new ArrayList<>() );
|
||||
|
||||
final boolean finishImmediately;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class MojoExecutorStub
|
|||
extends MojoExecutor
|
||||
{ // This is being lazy instead of making interface
|
||||
|
||||
public List<MojoExecution> executions = Collections.synchronizedList( new ArrayList<MojoExecution>() );
|
||||
public List<MojoExecution> executions = Collections.synchronizedList(new ArrayList<>() );
|
||||
|
||||
@Override
|
||||
public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ConsoleMavenTransferListener
|
|||
{
|
||||
|
||||
private Map<TransferResource, Long> transfers = Collections.synchronizedMap(
|
||||
new LinkedHashMap<TransferResource, Long>() );
|
||||
new LinkedHashMap<>() );
|
||||
|
||||
private boolean printResourceNames;
|
||||
private int lastLength;
|
||||
|
|
|
@ -437,7 +437,7 @@ public class DefaultModelBuilder
|
|||
public ModelBuildingResult build( ModelBuildingRequest request, ModelBuildingResult result )
|
||||
throws ModelBuildingException
|
||||
{
|
||||
return build( request, result, new LinkedHashSet<String>() );
|
||||
return build( request, result, new LinkedHashSet<>() );
|
||||
}
|
||||
|
||||
private ModelBuildingResult build( ModelBuildingRequest request, ModelBuildingResult result,
|
||||
|
|
|
@ -75,7 +75,7 @@ public class RemoteSnapshotMetadataTest
|
|||
String datePart = ts.replaceAll( "\\..*", "" );
|
||||
|
||||
/* Allow for this test running across midnight */
|
||||
Set<String> expected = new HashSet<String>( Arrays.asList( dateBefore, dateAfter ) );
|
||||
Set<String> expected = new HashSet<>( Arrays.asList( dateBefore, dateAfter ) );
|
||||
assertTrue( "Expected " + datePart + " to be in " + expected,
|
||||
expected.contains( datePart ) );
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class DefaultSettingsBuildingResult
|
|||
DefaultSettingsBuildingResult( Settings effectiveSettings, List<SettingsProblem> problems )
|
||||
{
|
||||
this.effectiveSettings = effectiveSettings;
|
||||
this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>();
|
||||
this.problems = ( problems != null ) ? problems : new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,7 @@ class DefaultSettingsProblemCollector
|
|||
|
||||
DefaultSettingsProblemCollector( List<SettingsProblem> problems )
|
||||
{
|
||||
this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>();
|
||||
this.problems = ( problems != null ) ? problems : new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<SettingsProblem> getProblems()
|
||||
|
|
|
@ -43,9 +43,9 @@ class DefaultSettingsDecryptionResult
|
|||
|
||||
DefaultSettingsDecryptionResult( List<Server> servers, List<Proxy> proxies, List<SettingsProblem> problems )
|
||||
{
|
||||
this.servers = ( servers != null ) ? servers : new ArrayList<Server>();
|
||||
this.proxies = ( proxies != null ) ? proxies : new ArrayList<Proxy>();
|
||||
this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>();
|
||||
this.servers = ( servers != null ) ? servers : new ArrayList<>();
|
||||
this.proxies = ( proxies != null ) ? proxies : new ArrayList<>();
|
||||
this.problems = ( problems != null ) ? problems : new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue