Skip to content

Commit

Permalink
[MNG-6847] Use diamond operator
Browse files Browse the repository at this point in the history
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.staticanalysis.UseDiamondOperator?organizationId=QXBhY2hlIE1hdmVu

Co-authored-by: Moderne <team@moderne.io>
  • Loading branch information
timtebeek and TeamModerne committed Aug 19, 2023
1 parent 4d0130c commit f428df7
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
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 @@ -87,7 +87,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 +102,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 @@ -284,7 +284,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 +360,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 +442,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

0 comments on commit f428df7

Please sign in to comment.