Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-6847] Use diamond operator #153

Merged
merged 1 commit into from
Aug 29, 2023
Merged
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 @@ -155,13 +155,13 @@ public List<Assembly> readAssemblies(final AssemblerConfigurationSource configSo
@Override
public Assembly getAssemblyForDescriptorReference(final String ref, final AssemblerConfigurationSource configSource)
throws AssemblyReadException, InvalidAssemblerConfigurationException {
return addAssemblyForDescriptorReference(ref, configSource, new ArrayList<Assembly>(1));
return addAssemblyForDescriptorReference(ref, configSource, new ArrayList<>(1));
}

@Override
public Assembly getAssemblyFromDescriptorFile(final File file, final AssemblerConfigurationSource configSource)
throws AssemblyReadException, InvalidAssemblerConfigurationException {
return addAssemblyFromDescriptorFile(file, configSource, new ArrayList<Assembly>(1));
return addAssemblyFromDescriptorFile(file, configSource, new ArrayList<>(1));
}

private Assembly addAssemblyForDescriptorReference(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
class DefaultMessageHolder implements MessageHolder {

private List<Message> messages = new ArrayList<Message>();
private List<Message> messages = new ArrayList<>();

private Message currentMessage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ final class Locator {
*/
Locator(List<LocatorStrategy> strategies, MessageHolder messageHolder) {
this.messageHolder = messageHolder;
this.strategies = new ArrayList<LocatorStrategy>(strategies);
this.strategies = new ArrayList<>(strategies);
}

/**
* Create instance.
*/
Locator() {
this.messageHolder = new DefaultMessageHolder();
this.strategies = new ArrayList<LocatorStrategy>();
this.strategies = new ArrayList<>();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ final class MessageLevels {
private static final List<String> LEVEL_NAMES;

static {
List<String> names = new ArrayList<String>();
List<String> names = new ArrayList<>();
names.add("DEBUG");
names.add("INFO");
names.add("WARN");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.io.IOException;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Set;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Model;
Expand Down Expand Up @@ -87,7 +86,7 @@ public void testExecute_ShouldAddOneDependencyFromProject()
project.setArtifacts(Collections.singleton(artifact));

when(dependencyResolver.resolveDependencySets(eq(assembly), isNull(), anyList()))
.thenReturn(new LinkedHashMap<DependencySet, Set<Artifact>>());
.thenReturn(new LinkedHashMap<>());

this.phase.execute(assembly, null, null);

Expand All @@ -102,7 +101,7 @@ public void testExecute_ShouldNotAddDependenciesWhenProjectHasNone() throws Exce
assembly.setIncludeBaseDirectory(false);

when(dependencyResolver.resolveDependencySets(eq(assembly), isNull(), anyList()))
.thenReturn(new LinkedHashMap<DependencySet, Set<Artifact>>());
.thenReturn(new LinkedHashMap<>());

this.phase.execute(assembly, null, null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.apache.maven.plugins.assembly.archive.DefaultAssemblyArchiverTest;
import org.apache.maven.plugins.assembly.artifact.DependencyResolver;
import org.apache.maven.plugins.assembly.model.Assembly;
import org.apache.maven.plugins.assembly.model.DependencySet;
import org.apache.maven.plugins.assembly.model.FileSet;
import org.apache.maven.plugins.assembly.model.ModuleBinaries;
import org.apache.maven.plugins.assembly.model.ModuleSet;
Expand Down Expand Up @@ -284,7 +283,7 @@ public void testExecute_ShouldAddOneModuleSetWithOneModuleInIt() throws Exceptio
assembly.addModuleSet(ms);

when(dependencyResolver.resolveDependencySets(eq(assembly), eq(ms), eq(configSource), anyList()))
.thenReturn(new LinkedHashMap<DependencySet, Set<Artifact>>());
.thenReturn(new LinkedHashMap<>());
DefaultAssemblyArchiverTest.setupInterpolators(configSource, module);

this.phase.execute(assembly, archiver, configSource);
Expand Down Expand Up @@ -360,7 +359,7 @@ public void testAddModuleBinaries_ShouldAddOneModuleAttachmentArtifactAndNoDeps(
final Set<MavenProject> projects = singleton(project);

when(dependencyResolver.resolveDependencySets(isNull(), isNull(), eq(configSource), anyList()))
.thenReturn(new LinkedHashMap<DependencySet, Set<Artifact>>());
.thenReturn(new LinkedHashMap<>());
DefaultAssemblyArchiverTest.setupInterpolators(configSource, project);

this.phase.addModuleBinaries(null, null, binaries, projects, archiver, configSource);
Expand Down Expand Up @@ -442,7 +441,7 @@ public void testAddModuleBinaries_ShouldAddOneModuleArtifactAndNoDeps() throws E

when(dependencyResolver.resolveDependencySets(
isNull(), isNull(), any(AssemblerConfigurationSource.class), anyList()))
.thenReturn(new LinkedHashMap<DependencySet, Set<Artifact>>());
.thenReturn(new LinkedHashMap<>());
DefaultAssemblyArchiverTest.setupInterpolators(configSource, project);

this.phase.addModuleBinaries(null, null, binaries, projects, archiver, configSource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ private MavenProject createMavenProject(

final Artifact pomArtifact = newArtifact(groupId, artifactId, version);
project.setArtifact(pomArtifact);
project.setArtifacts(new HashSet<Artifact>());
project.setDependencyArtifacts(new HashSet<Artifact>());
project.setArtifacts(new HashSet<>());
project.setDependencyArtifacts(new HashSet<>());

project.setFile(new File(basedir, "pom.xml"));

Expand Down