Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public MultipleArtifactsNotFoundException( Artifact originatingArtifact,
List<Artifact> missingArtifacts,
List<ArtifactRepository> remoteRepositories )
{
this( originatingArtifact, new ArrayList<Artifact>(), missingArtifacts, remoteRepositories );
this( originatingArtifact, new ArrayList<>(), missingArtifacts, remoteRepositories );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void execute( Runnable command )
else
{
executor = new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(), new DaemonThreadCreator() );
new LinkedBlockingQueue<>(), new DaemonThreadCreator() );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public DuplicateProjectException( String message, Map<String, List<File>> collis
{
super( message, (File) null );

this.collisions = ( collisions != null ) ? collisions : new LinkedHashMap<String, List<File>>();
this.collisions = ( collisions != null ) ? collisions : new LinkedHashMap<>();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public MavenExecutionRequest populateFromToolchains( MavenExecutionRequest reque
{
if ( !groupedToolchains.containsKey( model.getType() ) )
{
groupedToolchains.put( model.getType(), new ArrayList<ToolchainModel>() );
groupedToolchains.put( model.getType(), new ArrayList<>() );
}

groupedToolchains.get( model.getType() ).add( model );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand All @@ -65,7 +65,7 @@ public MavenExecutionResult setTopologicallySortedProjects( List<MavenProject> t
public List<MavenProject> getTopologicallySortedProjects()
{
return null == topologicallySortedProjects
? Collections.<MavenProject>emptyList()
? Collections.emptyList()
: Collections.unmodifiableList( topologicallySortedProjects );

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void setupMojoExecution( MavenSession session, MavenProject project, Mojo

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 )
Expand Down Expand Up @@ -331,7 +331,7 @@ public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public DependencyContext( MavenProject project, Collection<String> scopesToColle
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
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;
Expand Down Expand Up @@ -108,7 +107,7 @@ public void buildProject( MavenSession session, MavenSession rootSession, Reacto
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ private ProjectBuildingResult build( File pomFile, ModelSource modelSource, Inte

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() )
{
Expand Down Expand Up @@ -374,7 +374,7 @@ public List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive
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 );
Expand All @@ -384,8 +384,8 @@ public List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive
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
{
Expand Down Expand Up @@ -465,7 +465,7 @@ private boolean build( List<ProjectBuildingResult> results, List<InterimResult>
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 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ public class CacheRecord
{
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();
Expand Down Expand Up @@ -310,11 +310,11 @@ public ResolutionGroup get( Artifact artifact, boolean resolveManagedVersions, A
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() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Map<String, Object> retrieveContext( MavenSession session )
}
}

return ( context != null ) ? context : new HashMap<String, Object>();
return ( context != null ) ? context : new HashMap<>();
}

public static final String getStorageKey( String type )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void testResolveBuildPlan()
final BuilderCommon builderCommon = getBuilderCommon();
final MavenExecutionPlan plan =
builderCommon.resolveBuildPlan( session1, ProjectDependencyGraphStub.A, taskSegment1,
new HashSet<Artifact>() );
new HashSet<>() );
assertEquals( LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan().size(), plan.size() );

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ else if ( !parentIds.add( parentData.getId() ) )
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void gregorianCalendarIsUsed()
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 ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down