From 761e778a81123ad34921453f935006fcacf98c76 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 25 Sep 2023 21:34:36 +0000 Subject: [PATCH] [MNG-6847] Use diamond operator Use this link to re-run the recipe: https://app.moderne.io/recipes/builder/SEvWu02zw?organizationId=QXBhY2hlIE1hdmVu Co-authored-by: Moderne --- .../apache/maven/artifact/resolver/ArtifactResolverTest.java | 2 +- .../java/org/eclipse/sisu/plexus/PlexusXmlBeanConverter.java | 2 +- .../src/main/java/org/apache/maven/model/InputLocation.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java index 897862f8bc9e..2b8bc614316b 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java @@ -176,7 +176,7 @@ void testResolutionOfAnArtifactWhereOneRemoteRepositoryIsBadButOneIsGood() throw public void testReadRepoFromModel() throws Exception { Artifact m = createArtifact(TestMavenWorkspaceReader.ARTIFACT_ID, TestMavenWorkspaceReader.VERSION); ArtifactMetadataSource source = getContainer().lookup(ArtifactMetadataSource.class, "maven"); - ResolutionGroup group = source.retrieve(m, localRepository(), new ArrayList()); + ResolutionGroup group = source.retrieve(m, localRepository(), new ArrayList<>()); List repositories = group.getResolutionRepositories(); assertEquals(1, repositories.size(), "There should be one repository!"); ArtifactRepository repository = repositories.get(0); diff --git a/maven-embedder/src/main/java/org/eclipse/sisu/plexus/PlexusXmlBeanConverter.java b/maven-embedder/src/main/java/org/eclipse/sisu/plexus/PlexusXmlBeanConverter.java index 709f0d0662f3..7ed8d31ca941 100644 --- a/maven-embedder/src/main/java/org/eclipse/sisu/plexus/PlexusXmlBeanConverter.java +++ b/maven-embedder/src/main/java/org/eclipse/sisu/plexus/PlexusXmlBeanConverter.java @@ -240,7 +240,7 @@ private Object parseBean(final MXParser parser, final TypeLiteral toType, fin final Object bean = newImplementation(clazz); // build map of all known bean properties belonging to the chosen implementation - final Map> propertyMap = new HashMap>(); + final Map> propertyMap = new HashMap<>(); for (final BeanProperty property : new BeanProperties(clazz)) { final String name = property.getName(); if (!propertyMap.containsKey(name)) { diff --git a/maven-model/src/main/java/org/apache/maven/model/InputLocation.java b/maven-model/src/main/java/org/apache/maven/model/InputLocation.java index a9b1a64d5138..1b48e0463e49 100644 --- a/maven-model/src/main/java/org/apache/maven/model/InputLocation.java +++ b/maven-model/src/main/java/org/apache/maven/model/InputLocation.java @@ -192,7 +192,7 @@ public void setLocation(Object key, InputLocation location) { public void setOtherLocation(Object key, InputLocation location) { if (location != null) { if (this.locations == null) { - this.locations = new java.util.LinkedHashMap(); + this.locations = new java.util.LinkedHashMap<>(); } this.locations.put(key, location); } @@ -277,7 +277,7 @@ public static InputLocation merge( } else if (targetLocations == null) { locations = sourceLocations; } else { - locations = new java.util.LinkedHashMap(); + locations = new java.util.LinkedHashMap<>(); for (java.util.Iterator it = indices.iterator(); it.hasNext(); ) { InputLocation location; Integer index = it.next();