From 433611003b767dfc69e551ed5e1e06e0cc67e7be Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Tue, 29 Aug 2023 12:50:44 +0100 Subject: [PATCH] [MNG-6847] Use diamond operator (#288) * [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 * Restore core-it-suite/src/test/resources/mng-5581-lifecycle-mapping-delegate/extension/src/main/java/org/apache/maven/its/mng5581/lifecyclemappingdelegate/TestLifecycleMappingDelegate.java --------- Co-authored-by: Moderne --- .../org/apache/maven/it/MavenITmng0768OfflineModeTest.java | 2 +- .../it/MavenITmng4348NoUnnecessaryRepositoryAccessTest.java | 2 +- .../MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java | 2 +- .../it/MavenITmng4554PluginPrefixMappingUpdateTest.java | 6 +++--- ...2PluginVersionResolutionDoesntTouchDisabledRepoTest.java | 2 +- .../maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java | 2 +- .../maven/it/MavenITmng6057CheckReactorOrderTest.java | 2 +- .../org/apache/maven/it/MavenITmng6391PrintVersionTest.java | 2 +- .../src/main/java/org/apache/maven/it/mng3203/App.java | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java index 339fd6d38c..4b6689b3ba 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java @@ -60,7 +60,7 @@ public class MavenITmng0768OfflineModeTest extends AbstractMavenIntegrationTestC public void testitMNG768() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0768"); - final List requestedUris = Collections.synchronizedList(new ArrayList()); + final List requestedUris = Collections.synchronizedList(new ArrayList<>()); Handler repoHandler = new AbstractHandler() { public void handle( diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4348NoUnnecessaryRepositoryAccessTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4348NoUnnecessaryRepositoryAccessTest.java index 799e7c4060..e3e655a93c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4348NoUnnecessaryRepositoryAccessTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4348NoUnnecessaryRepositoryAccessTest.java @@ -60,7 +60,7 @@ public class MavenITmng4348NoUnnecessaryRepositoryAccessTest extends AbstractMav Verifier verifier = newVerifier(testDir.getAbsolutePath()); - final List requestedUris = Collections.synchronizedList(new ArrayList()); + final List requestedUris = Collections.synchronizedList(new ArrayList<>()); Handler repoHandler = new AbstractHandler() { @Override diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java index 4bb1ab0220..ab0ad0cc50 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java @@ -62,7 +62,7 @@ public class MavenITmng4500NoUpdateOfTimestampedSnapshotsTest extends AbstractMa String pomUri = "/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.pom"; String jarUri = "/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.jar"; - final List requestedUris = Collections.synchronizedList(new ArrayList()); + final List requestedUris = Collections.synchronizedList(new ArrayList<>()); AbstractHandler logHandler = new AbstractHandler() { @Override diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4554PluginPrefixMappingUpdateTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4554PluginPrefixMappingUpdateTest.java index dea98e65f7..fefed46762 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4554PluginPrefixMappingUpdateTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4554PluginPrefixMappingUpdateTest.java @@ -63,7 +63,7 @@ public class MavenITmng4554PluginPrefixMappingUpdateTest extends AbstractMavenIn String metadataUri = "/repo-1/org/apache/maven/its/mng4554/maven-metadata.xml"; - final List requestedUris = Collections.synchronizedList(new ArrayList()); + final List requestedUris = Collections.synchronizedList(new ArrayList<>()); AbstractHandler logHandler = new AbstractHandler() { @Override @@ -142,7 +142,7 @@ public class MavenITmng4554PluginPrefixMappingUpdateTest extends AbstractMavenIn String metadataUri = "/repo-1/org/apache/maven/its/mng4554/maven-metadata.xml"; - final List requestedUris = Collections.synchronizedList(new ArrayList()); + final List requestedUris = Collections.synchronizedList(new ArrayList<>()); AbstractHandler logHandler = new AbstractHandler() { @Override @@ -224,7 +224,7 @@ public class MavenITmng4554PluginPrefixMappingUpdateTest extends AbstractMavenIn String metadataUri = "/repo-it/org/apache/maven/its/mng4554/maven-metadata.xml"; - final List requestedUris = Collections.synchronizedList(new ArrayList()); + final List requestedUris = Collections.synchronizedList(new ArrayList<>()); AbstractHandler logHandler = new AbstractHandler() { @Override diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest.java index 011a18b780..aea30bd82d 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest.java @@ -59,7 +59,7 @@ public class MavenITmng4772PluginVersionResolutionDoesntTouchDisabledRepoTest ex public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4772"); - final List requestedUris = Collections.synchronizedList(new ArrayList()); + final List requestedUris = Collections.synchronizedList(new ArrayList<>()); AbstractHandler logHandler = new AbstractHandler() { @Override diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java index 8102015622..697cee2dd0 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5064SuppressSnapshotUpdatesTest.java @@ -61,7 +61,7 @@ public class MavenITmng5064SuppressSnapshotUpdatesTest extends AbstractMavenInte String metadataUri = "org/apache/maven/its/mng5064/dep/0.1-SNAPSHOT/maven-metadata.xml"; - final List requestedUris = Collections.synchronizedList(new ArrayList()); + final List requestedUris = Collections.synchronizedList(new ArrayList<>()); AbstractHandler logHandler = new AbstractHandler() { @Override diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java index 5ba8a40572..56e69d25ef 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java @@ -84,7 +84,7 @@ public class MavenITmng6057CheckReactorOrderTest extends AbstractMavenIntegratio * */ private List extractReactorBuildOrder(List loadedLines) { - List resultingLines = new LinkedList(); + List resultingLines = new LinkedList<>(); boolean start = false; for (String line : loadedLines) { if (start) { diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java index 8bfac3282d..cd56d7b7aa 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java @@ -144,7 +144,7 @@ public class MavenITmng6391PrintVersionTest extends AbstractMavenIntegrationTest * */ private List extractReactorBuildOrder(List loadedLines) { - List resultingLines = new LinkedList(); + List resultingLines = new LinkedList<>(); boolean start = false; for (String line : loadedLines) { if (start) { diff --git a/its/core-it-suite/src/test/resources/mng-3203/src/main/java/org/apache/maven/it/mng3203/App.java b/its/core-it-suite/src/test/resources/mng-3203/src/main/java/org/apache/maven/it/mng3203/App.java index 569e06357f..73b77163f4 100644 --- a/its/core-it-suite/src/test/resources/mng-3203/src/main/java/org/apache/maven/it/mng3203/App.java +++ b/its/core-it-suite/src/test/resources/mng-3203/src/main/java/org/apache/maven/it/mng3203/App.java @@ -27,6 +27,6 @@ import java.util.List; */ public class App { public static void main(String[] args) { - List stuff = new ArrayList(); + List stuff = new ArrayList<>(); } }