From 0145e95bd48614c2c8df75211a0100c68931e4a4 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Sun, 20 Aug 2023 12:23:58 +0000 Subject: [PATCH] [MNG-6847] Use diamond operator As discussed on - https://github.com/apache/maven-scm/pull/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 --- .../apache/maven/plugins/ejb/EjbMojoTest.java | 23 +++++++++---------- .../ejb/stub/MavenProjectBuildStub.java | 12 +++++----- .../maven/plugins/ejb/stub/ModelStub.java | 2 +- .../plugins/ejb/utils/JarContentChecker.java | 4 ++-- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/test/java/org/apache/maven/plugins/ejb/EjbMojoTest.java b/src/test/java/org/apache/maven/plugins/ejb/EjbMojoTest.java index ffc7761..b8f0d0d 100644 --- a/src/test/java/org/apache/maven/plugins/ejb/EjbMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/ejb/EjbMojoTest.java @@ -221,11 +221,11 @@ public void testClientJarDefaultInclusionsExclusions() throws Exception { * @throws Exception if any exception occurs */ public void testClientJarInclusions() throws Exception { - final List inclusions = new LinkedList(); + final List inclusions = new LinkedList<>(); inclusions.add("**/*Include.class"); final MavenProjectResourcesStub project = createTestProject("client-includes"); - final EjbMojo mojo = lookupMojoWithSettings(project, inclusions, new LinkedList(), null); + final EjbMojo mojo = lookupMojoWithSettings(project, inclusions, new LinkedList<>(), null); // put this on the target output dir project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE); @@ -262,11 +262,11 @@ public void testClientJarInclusions() throws Exception { */ public void testClientJarExclusions() throws Exception { - final List exclusions = new LinkedList(); + final List exclusions = new LinkedList<>(); exclusions.add("**/*Exclude.class"); final MavenProjectResourcesStub project = createTestProject("client-excludes"); - final EjbMojo mojo = lookupMojoWithSettings(project, new LinkedList(), exclusions, null); + final EjbMojo mojo = lookupMojoWithSettings(project, new LinkedList<>(), exclusions, null); // put this on the target output dir project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE); @@ -302,12 +302,11 @@ public void testClientJarExclusions() throws Exception { * @throws Exception if any exception occurs */ public void testMainJarExclusions() throws Exception { - final List exclusions = new LinkedList(); + final List exclusions = new LinkedList<>(); exclusions.add("**/*Exclude.class"); final MavenProjectResourcesStub project = createTestProject("main-excludes"); - final EjbMojo mojo = - lookupMojoWithSettings(project, new LinkedList(), new LinkedList(), exclusions); + final EjbMojo mojo = lookupMojoWithSettings(project, new LinkedList<>(), new LinkedList<>(), exclusions); // put this on the target output dir project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE); @@ -343,12 +342,12 @@ public void testMainJarExclusions() throws Exception { * @throws Exception if any exception occurs */ public void testClientJarInclusionsWithSubPackage() throws Exception { - final List inclusions = new LinkedList(); + final List inclusions = new LinkedList<>(); inclusions.add("org/sample/ejb/*.class"); final MavenProjectResourcesStub project = createTestProject("client-includes-subpackage"); - final EjbMojo mojo = lookupMojoWithSettings(project, inclusions, new LinkedList(), null); + final EjbMojo mojo = lookupMojoWithSettings(project, inclusions, new LinkedList<>(), null); // put this on the target output dir project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE); @@ -385,11 +384,11 @@ public void testClientJarInclusionsWithSubPackage() throws Exception { */ public void testClientJarExclusionsWithEmptyPackage() throws Exception { - final LinkedList exclusions = new LinkedList(); + final LinkedList exclusions = new LinkedList<>(); exclusions.add("org/sample/ejb/**"); final MavenProjectResourcesStub project = createTestProject("client-excludes-emptypackage"); - final EjbMojo mojo = lookupMojoWithSettings(project, new LinkedList(), exclusions, null); + final EjbMojo mojo = lookupMojoWithSettings(project, new LinkedList<>(), exclusions, null); // put this on the target output dir project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE); @@ -562,7 +561,7 @@ protected EjbMojo lookupMojoWithSettings( } protected EjbMojo lookupMojoWithDefaultSettings(final MavenProject project) throws Exception { - return lookupMojoWithSettings(project, new LinkedList(), new LinkedList(), null); + return lookupMojoWithSettings(project, new LinkedList<>(), new LinkedList<>(), null); } protected void assertJarCreation( diff --git a/src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBuildStub.java b/src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBuildStub.java index 6aa96b3..7e570a4 100644 --- a/src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBuildStub.java +++ b/src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBuildStub.java @@ -77,12 +77,12 @@ public MavenProjectBuildStub(String key) throws Exception { super(key); this.build = new Build(); - this.resourcesFileList = new ArrayList(); - this.sourceFileList = new ArrayList(); - this.rootFileList = new ArrayList(); - this.directoryList = new ArrayList(); - this.targetClassesList = new ArrayList(); - this.dataMap = new HashMap(); + this.resourcesFileList = new ArrayList<>(); + this.sourceFileList = new ArrayList<>(); + this.rootFileList = new ArrayList<>(); + this.directoryList = new ArrayList<>(); + this.targetClassesList = new ArrayList<>(); + this.dataMap = new HashMap<>(); setupBuild(); model.setBuild(build); diff --git a/src/test/java/org/apache/maven/plugins/ejb/stub/ModelStub.java b/src/test/java/org/apache/maven/plugins/ejb/stub/ModelStub.java index e9c2c5d..b6eeb9d 100644 --- a/src/test/java/org/apache/maven/plugins/ejb/stub/ModelStub.java +++ b/src/test/java/org/apache/maven/plugins/ejb/stub/ModelStub.java @@ -71,6 +71,6 @@ public Properties getProperties() { } public List getProfiles() { - return new LinkedList(); + return new LinkedList<>(); } } diff --git a/src/test/java/org/apache/maven/plugins/ejb/utils/JarContentChecker.java b/src/test/java/org/apache/maven/plugins/ejb/utils/JarContentChecker.java index 728d865..e515e2f 100644 --- a/src/test/java/org/apache/maven/plugins/ejb/utils/JarContentChecker.java +++ b/src/test/java/org/apache/maven/plugins/ejb/utils/JarContentChecker.java @@ -39,8 +39,8 @@ public class JarContentChecker { private Map directoryMap; public JarContentChecker() { - fileMap = new HashMap(); - directoryMap = new HashMap(); + fileMap = new HashMap<>(); + directoryMap = new HashMap<>(); } public void addDirectory(File dir) {