Skip to content

Commit 34348ec

Browse files
timtebeekTeamModerne
authored andcommitted
[MNG-6847] Use diamond operator
As discussed on - apache/maven-scm#184 - https://issues.apache.org/jira/browse/MNG-6847 Review requested of @elharo Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.staticanalysis.UseDiamondOperator?organizationId=QXBhY2hlIE1hdmVu Co-authored-by: Moderne <[email protected]>
1 parent 0062083 commit 34348ec

File tree

5 files changed

+46
-46
lines changed

5 files changed

+46
-46
lines changed

src/main/java/org/apache/maven/plugins/dependency/tree/BuildingDependencyNodeVisitor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public BuildingDependencyNodeVisitor() {
7070
public BuildingDependencyNodeVisitor(DependencyNodeVisitor visitor) {
7171
this.visitor = visitor;
7272

73-
parentNodes = new Stack<DependencyNode>();
73+
parentNodes = new Stack<>();
7474
}
7575

7676
// DependencyNodeVisitor methods ------------------------------------------
@@ -90,7 +90,7 @@ public boolean visit(DependencyNode node) {
9090
node.getOptional(),
9191
node.getExclusions(),
9292
node.toNodeString());
93-
newNode.setChildren(new ArrayList<DependencyNode>());
93+
newNode.setChildren(new ArrayList<>());
9494

9595
if (parentNodes.empty()) {
9696
rootNode = newNode;

src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public void testNoTransitive() throws Exception {
156156

157157
public void testExcludeType() throws Exception {
158158
mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
159-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
159+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
160160
mojo.excludeTypes = "jar";
161161
mojo.execute();
162162

@@ -170,7 +170,7 @@ public void testExcludeType() throws Exception {
170170

171171
public void testIncludeType() throws Exception {
172172
mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
173-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
173+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
174174

175175
mojo.includeTypes = "jar";
176176
mojo.excludeTypes = "jar";
@@ -198,7 +198,7 @@ public void testIncludeType() throws Exception {
198198

199199
public void testExcludeArtifactId() throws Exception {
200200
mojo.getProject().setArtifacts(stubFactory.getArtifactArtifacts());
201-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
201+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
202202
mojo.excludeArtifactIds = "one";
203203
mojo.execute();
204204

@@ -212,7 +212,7 @@ public void testExcludeArtifactId() throws Exception {
212212

213213
public void testIncludeArtifactId() throws Exception {
214214
mojo.getProject().setArtifacts(stubFactory.getArtifactArtifacts());
215-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
215+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
216216

217217
mojo.includeArtifactIds = "one";
218218
mojo.excludeArtifactIds = "one";
@@ -240,7 +240,7 @@ public void testIncludeArtifactId() throws Exception {
240240

241241
public void testIncludeGroupId() throws Exception {
242242
mojo.getProject().setArtifacts(stubFactory.getGroupIdArtifacts());
243-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
243+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
244244
mojo.includeGroupIds = "one";
245245
mojo.excludeGroupIds = "one";
246246
// shouldn't get anything
@@ -267,7 +267,7 @@ public void testIncludeGroupId() throws Exception {
267267

268268
public void testExcludeGroupId() throws Exception {
269269
mojo.getProject().setArtifacts(stubFactory.getGroupIdArtifacts());
270-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
270+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
271271
mojo.excludeGroupIds = "one";
272272
mojo.execute();
273273

@@ -282,7 +282,7 @@ public void testExcludeGroupId() throws Exception {
282282

283283
public void testExcludeMultipleGroupIds() throws Exception {
284284
mojo.getProject().setArtifacts(stubFactory.getGroupIdArtifacts());
285-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
285+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
286286
mojo.excludeGroupIds = "one,two";
287287
mojo.execute();
288288

@@ -298,7 +298,7 @@ public void testExcludeMultipleGroupIds() throws Exception {
298298

299299
public void testExcludeClassifier() throws Exception {
300300
mojo.getProject().setArtifacts(stubFactory.getClassifiedArtifacts());
301-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
301+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
302302
mojo.excludeClassifiers = "one";
303303
mojo.execute();
304304

@@ -312,7 +312,7 @@ public void testExcludeClassifier() throws Exception {
312312

313313
public void testIncludeClassifier() throws Exception {
314314
mojo.getProject().setArtifacts(stubFactory.getClassifiedArtifacts());
315-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
315+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
316316

317317
mojo.includeClassifiers = "one";
318318
mojo.excludeClassifiers = "one";
@@ -340,7 +340,7 @@ public void testIncludeClassifier() throws Exception {
340340

341341
public void testSubPerType() throws Exception {
342342
mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
343-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
343+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
344344
mojo.useSubDirectoryPerType = true;
345345
mojo.execute();
346346

@@ -555,7 +555,7 @@ public void testGetDependencies() throws MojoExecutionException {
555555

556556
public void testExcludeProvidedScope() throws Exception {
557557
mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
558-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
558+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
559559
mojo.excludeScope = "provided";
560560
// mojo.silent = false;
561561

@@ -573,7 +573,7 @@ public void testExcludeProvidedScope() throws Exception {
573573

574574
public void testExcludeSystemScope() throws Exception {
575575
mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
576-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
576+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
577577
mojo.excludeScope = "system";
578578
// mojo.silent = false;
579579

@@ -591,7 +591,7 @@ public void testExcludeSystemScope() throws Exception {
591591

592592
public void testExcludeCompileScope() throws Exception {
593593
mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
594-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
594+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
595595
mojo.excludeScope = "compile";
596596
mojo.execute();
597597
ScopeArtifactFilter saf = new ScopeArtifactFilter(mojo.excludeScope);
@@ -607,7 +607,7 @@ public void testExcludeCompileScope() throws Exception {
607607

608608
public void testExcludeTestScope() throws IOException, MojoFailureException {
609609
mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
610-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
610+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
611611
mojo.excludeScope = "test";
612612

613613
try {
@@ -620,7 +620,7 @@ public void testExcludeTestScope() throws IOException, MojoFailureException {
620620

621621
public void testExcludeRuntimeScope() throws Exception {
622622
mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
623-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
623+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
624624
mojo.excludeScope = "runtime";
625625
mojo.execute();
626626
ScopeArtifactFilter saf = new ScopeArtifactFilter(mojo.excludeScope);

src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected void setUp() throws Exception {
8282

8383
public void testCopyDependenciesMojoIncludeCompileScope() throws Exception {
8484
mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
85-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
85+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
8686
mojo.includeScope = "compile";
8787

8888
mojo.execute();
@@ -100,7 +100,7 @@ public void testCopyDependenciesMojoIncludeCompileScope() throws Exception {
100100

101101
public void testCopyDependenciesMojoIncludeTestScope() throws Exception {
102102
mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
103-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
103+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
104104
mojo.includeScope = "test";
105105

106106
mojo.execute();
@@ -118,7 +118,7 @@ public void testCopyDependenciesMojoIncludeTestScope() throws Exception {
118118

119119
public void testCopyDependenciesMojoIncludeRuntimeScope() throws Exception {
120120
mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
121-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
121+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
122122
mojo.includeScope = "runtime";
123123

124124
mojo.execute();
@@ -136,7 +136,7 @@ public void testCopyDependenciesMojoIncludeRuntimeScope() throws Exception {
136136

137137
public void testCopyDependenciesMojoIncludeprovidedScope() throws Exception {
138138
mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
139-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
139+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
140140
mojo.includeScope = "provided";
141141

142142
mojo.execute();
@@ -152,7 +152,7 @@ public void testCopyDependenciesMojoIncludeprovidedScope() throws Exception {
152152

153153
public void testCopyDependenciesMojoIncludesystemScope() throws Exception {
154154
mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
155-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
155+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
156156
mojo.includeScope = "system";
157157

158158
mojo.execute();
@@ -183,7 +183,7 @@ public void testSubPerArtifact() throws Exception {
183183

184184
public void testSubPerArtifactAndType() throws Exception {
185185
mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
186-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
186+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
187187
mojo.useSubDirectoryPerArtifact = true;
188188
mojo.useSubDirectoryPerType = true;
189189

@@ -201,7 +201,7 @@ public void testSubPerArtifactAndType() throws Exception {
201201

202202
public void testSubPerArtifactAndScope() throws Exception {
203203
mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
204-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
204+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
205205
mojo.useSubDirectoryPerArtifact = true;
206206
mojo.useSubDirectoryPerScope = true;
207207

@@ -322,7 +322,7 @@ public void testSubPerArtifactRemoveVersion() throws Exception {
322322

323323
public void testSubPerArtifactAndTypeRemoveVersion() throws Exception {
324324
mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
325-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
325+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
326326
mojo.useSubDirectoryPerArtifact = true;
327327
mojo.useSubDirectoryPerType = true;
328328
mojo.stripVersion = true;
@@ -357,7 +357,7 @@ public void testSubPerArtifactRemoveType() throws Exception {
357357

358358
public void testSubPerArtifactAndTypeRemoveType() throws Exception {
359359
mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
360-
mojo.getProject().setDependencyArtifacts(new HashSet<Artifact>());
360+
mojo.getProject().setDependencyArtifacts(new HashSet<>());
361361
mojo.useSubDirectoryPerArtifact = true;
362362
mojo.useSubDirectoryPerType = true;
363363
mojo.stripType = true;

0 commit comments

Comments
 (0)