Skip to content

Commit 4d75436

Browse files
timtebeekTeamModerne
authored andcommitted
[MNG-6847] Use diamond operator
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>
1 parent 040c398 commit 4d75436

File tree

12 files changed

+27
-27
lines changed

12 files changed

+27
-27
lines changed

src/main/java/org/apache/maven/resolver/internal/ant/AntModelResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class AntModelResolver
7272
this.repoSys = repoSys;
7373
this.remoteRepositoryManager = remoteRepositoryManager;
7474
this.repositories = repositories;
75-
this.repositoryIds = new HashSet<String>();
75+
this.repositoryIds = new HashSet<>();
7676
}
7777

7878
private AntModelResolver( final AntModelResolver original )
@@ -82,7 +82,7 @@ private AntModelResolver( final AntModelResolver original )
8282
this.repoSys = original.repoSys;
8383
this.remoteRepositoryManager = original.remoteRepositoryManager;
8484
this.repositories = original.repositories;
85-
this.repositoryIds = new HashSet<String>( original.repositoryIds );
85+
this.repositoryIds = new HashSet<>( original.repositoryIds );
8686
}
8787

8888
public void addRepository( final Repository repository )

src/main/java/org/apache/maven/resolver/internal/ant/ConverterUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private static Collection<org.eclipse.aether.graph.Exclusion> toExclusions( Coll
113113
Collection<Exclusion> exclusions2 )
114114
{
115115
Collection<org.eclipse.aether.graph.Exclusion> results =
116-
new LinkedHashSet<org.eclipse.aether.graph.Exclusion>();
116+
new LinkedHashSet<>();
117117
if ( exclusions1 != null )
118118
{
119119
for ( Exclusion exclusion : exclusions1 )
@@ -202,11 +202,11 @@ public static List<org.eclipse.aether.repository.RemoteRepository> toRepositorie
202202
}
203203
else
204204
{
205-
repositories = new ArrayList<RemoteRepository>();
205+
repositories = new ArrayList<>();
206206
}
207207

208208
List<org.eclipse.aether.repository.RemoteRepository> results =
209-
new ArrayList<org.eclipse.aether.repository.RemoteRepository>();
209+
new ArrayList<>();
210210
for ( RemoteRepository repo : repositories )
211211
{
212212
results.add( toRepository( repo ) );

src/main/java/org/apache/maven/resolver/internal/ant/ProjectWorkspaceReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class ProjectWorkspaceReader
4848

4949
private static final Object LOCK = new Object();
5050

51-
private Map<String, Artifact> artifacts = new ConcurrentHashMap<String, Artifact>();
51+
private Map<String, Artifact> artifacts = new ConcurrentHashMap<>();
5252

5353
public void addPom( Pom pom )
5454
{
@@ -107,7 +107,7 @@ public File findArtifact( Artifact artifact )
107107

108108
public List<String> findVersions( Artifact artifact )
109109
{
110-
List<String> versions = new ArrayList<String>();
110+
List<String> versions = new ArrayList<>();
111111
for ( Artifact art : artifacts.values() )
112112
{
113113
if ( ArtifactIdUtils.equalsVersionlessId( artifact, art ) )

src/main/java/org/apache/maven/resolver/internal/ant/SettingsUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static List<org.apache.maven.model.Profile> convert( List<Profile> profil
4343
return null;
4444
}
4545

46-
List<org.apache.maven.model.Profile> results = new ArrayList<org.apache.maven.model.Profile>();
46+
List<org.apache.maven.model.Profile> results = new ArrayList<>();
4747

4848
for ( Profile profile : profiles )
4949
{

src/main/java/org/apache/maven/resolver/internal/ant/tasks/AbstractDistTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected void validate()
4747
{
4848
getArtifacts().validate( this );
4949

50-
final Map<String, File> duplicates = new HashMap<String, File>();
50+
final Map<String, File> duplicates = new HashMap<>();
5151
for ( final Artifact artifact : getArtifacts().getArtifacts() )
5252
{
5353
final String key = artifact.getType() + ':' + artifact.getClassifier();

src/main/java/org/apache/maven/resolver/internal/ant/tasks/Layout.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ class Layout
5555
Layout( String layout )
5656
throws BuildException
5757
{
58-
Collection<String> valid = new HashSet<String>( Arrays.asList( GID, GID_DIRS, AID, VER, BVER, EXT, CLS ) );
59-
List<String> tokens = new ArrayList<String>();
58+
Collection<String> valid = new HashSet<>( Arrays.asList( GID, GID_DIRS, AID, VER, BVER, EXT, CLS ) );
59+
List<String> tokens = new ArrayList<>();
6060
Matcher m = Pattern.compile( "(\\{[^}]*\\})|([^{]+)" ).matcher( layout );
6161
while ( m.find() )
6262
{

src/main/java/org/apache/maven/resolver/internal/ant/tasks/Resolve.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class Resolve
5959
extends AbstractResolvingTask
6060
{
6161

62-
private List<ArtifactConsumer> consumers = new ArrayList<ArtifactConsumer>();
62+
private List<ArtifactConsumer> consumers = new ArrayList<>();
6363

6464
private boolean failOnMissingAttachments;
6565

@@ -132,7 +132,7 @@ public void execute()
132132
DependencyNode root = collectDependencies().getRoot();
133133
root.accept( new DependencyGraphLogger( this ) );
134134

135-
Map<String, Group> groups = new HashMap<String, Group>();
135+
Map<String, Group> groups = new HashMap<>();
136136
for ( ArtifactConsumer consumer : consumers )
137137
{
138138
String classifier = consumer.getClassifier();
@@ -215,8 +215,8 @@ public void setScopes( String scopes )
215215
throw new BuildException( "You must not specify both 'scopes' and 'classpath'" );
216216
}
217217

218-
Collection<String> included = new HashSet<String>();
219-
Collection<String> excluded = new HashSet<String>();
218+
Collection<String> included = new HashSet<>();
219+
Collection<String> excluded = new HashSet<>();
220220

221221
String[] split = scopes.split( "[, ]" );
222222
for ( String scope : split )
@@ -504,9 +504,9 @@ private static class Group
504504

505505
private String classifier;
506506

507-
private List<ArtifactConsumer> consumers = new ArrayList<ArtifactConsumer>();
507+
private List<ArtifactConsumer> consumers = new ArrayList<>();
508508

509-
private List<ArtifactRequest> requests = new ArrayList<ArtifactRequest>();
509+
private List<ArtifactRequest> requests = new ArrayList<>();
510510

511511
Group( String classifier )
512512
{
@@ -525,7 +525,7 @@ public void add( ArtifactConsumer consumer )
525525

526526
public void createRequests( DependencyNode node )
527527
{
528-
createRequests( node, new LinkedList<DependencyNode>() );
528+
createRequests( node, new LinkedList<>() );
529529
}
530530

531531
private void createRequests( DependencyNode node, LinkedList<DependencyNode> parents )

src/main/java/org/apache/maven/resolver/internal/ant/types/Artifacts.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class Artifacts
3333
implements ArtifactContainer
3434
{
3535

36-
private List<ArtifactContainer> containers = new ArrayList<ArtifactContainer>();
36+
private List<ArtifactContainer> containers = new ArrayList<>();
3737

3838
protected Artifacts getRef()
3939
{
@@ -86,7 +86,7 @@ public List<Artifact> getArtifacts()
8686
{
8787
return getRef().getArtifacts();
8888
}
89-
List<Artifact> artifacts = new ArrayList<Artifact>();
89+
List<Artifact> artifacts = new ArrayList<>();
9090
for ( ArtifactContainer container : containers )
9191
{
9292
artifacts.addAll( container.getArtifacts() );

src/main/java/org/apache/maven/resolver/internal/ant/types/Authentication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class Authentication
4141

4242
private String passphrase;
4343

44-
private List<String> servers = new ArrayList<String>();
44+
private List<String> servers = new ArrayList<>();
4545

4646
@Override
4747
public void setProject( Project project )

src/main/java/org/apache/maven/resolver/internal/ant/types/Dependencies.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public class Dependencies
4141

4242
private Pom pom;
4343

44-
private List<DependencyContainer> containers = new ArrayList<DependencyContainer>();
44+
private List<DependencyContainer> containers = new ArrayList<>();
4545

46-
private List<Exclusion> exclusions = new ArrayList<Exclusion>();
46+
private List<Exclusion> exclusions = new ArrayList<>();
4747

4848
private boolean nestedDependencies;
4949

@@ -64,7 +64,7 @@ public void validate( Task task )
6464
{
6565
throw new BuildException( "A <pom> used for dependency resolution has to be backed by a pom.xml file" );
6666
}
67-
Map<String, String> ids = new HashMap<String, String>();
67+
Map<String, String> ids = new HashMap<>();
6868
for ( DependencyContainer container : containers )
6969
{
7070
container.validate( task );

0 commit comments

Comments
 (0)