From: Lars Grefer Date: Wed, 12 Aug 2020 23:01:58 +0000 (+0200) Subject: Use the diamond operator where possible X-Git-Tag: V1_9_7M1~29^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e1bff9a5703baf17ec650b173bdfe776bf87125f;p=aspectj.git Use the diamond operator where possible Signed-off-by: Lars Grefer --- diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java index e59c16103..a5856afd9 100644 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java +++ b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java @@ -61,7 +61,7 @@ public class BrowserManager { private UserPreferencesAdapter preferencesAdapter; private static TopFrame topFrame = null; - private List configFiles = new ArrayList(); + private List configFiles = new ArrayList<>(); private JavaBuildOptions javaBuildOptions; public static BrowserManager getDefault() { @@ -182,7 +182,7 @@ public class BrowserManager { } private List getConfigFilesList(String[] configFiles) { - List configs = new ArrayList(); + List configs = new ArrayList<>(); for (String configFile : configFiles) { if (configFile.endsWith(BuildConfigManager.CONFIG_FILE_SUFFIX)) { configs.add(configFile); diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserOutputLocationManager.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserOutputLocationManager.java index 1b754d2f1..c721394e2 100644 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserOutputLocationManager.java +++ b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserOutputLocationManager.java @@ -47,7 +47,7 @@ public class BrowserOutputLocationManager implements IOutputLocationManager { } public List getAllOutputLocations() { - List outputDirs = new ArrayList(); + List outputDirs = new ArrayList<>(); outputDirs.add(new File(getCommonOutputDir())); return outputDirs; } diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java index b8dcf1c41..5188f8daf 100644 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java +++ b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java @@ -32,8 +32,8 @@ public class BrowserMessageHandler implements IUIBuildMessageHandler { private List messages; public BrowserMessageHandler() { - ignoring = new ArrayList(); - messages = new ArrayList(); + ignoring = new ArrayList<>(); + messages = new ArrayList<>(); ignore(IMessage.INFO); ignore(IMessage.WEAVEINFO); } diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/EditorManager.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/EditorManager.java index 12a7f8938..b737cf07e 100644 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/EditorManager.java +++ b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/EditorManager.java @@ -43,8 +43,8 @@ public class EditorManager { private EditorAdapter editor = null; private BasicEditor basicEditor = null; - private ArrayList editorListeners = new ArrayList(); - private Vector editors = new Vector(); + private ArrayList editorListeners = new ArrayList<>(); + private Vector editors = new Vector<>(); private JPanel editor_panel = null; private Box editors_box = Box.createVerticalBox(); diff --git a/ajde.core/src/main/java/org/aspectj/ajde/core/JavaOptions.java b/ajde.core/src/main/java/org/aspectj/ajde/core/JavaOptions.java index 5de225339..cab96198b 100644 --- a/ajde.core/src/main/java/org/aspectj/ajde/core/JavaOptions.java +++ b/ajde.core/src/main/java/org/aspectj/ajde/core/JavaOptions.java @@ -68,7 +68,7 @@ public final class JavaOptions { public static Map getDefaultJavaOptions() { if (defaultOptionsMap != null) return defaultOptionsMap; - defaultOptionsMap = new HashMap(); + defaultOptionsMap = new HashMap<>(); defaultOptionsMap.put(COMPLIANCE_LEVEL, VERSION_14); defaultOptionsMap.put(SOURCE_COMPATIBILITY_LEVEL, VERSION_13); defaultOptionsMap.put(PRESERVE_ALL_LOCALS, OPTIMIZE); diff --git a/ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java b/ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java index b64588001..6547d101c 100644 --- a/ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java +++ b/ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java @@ -272,7 +272,7 @@ public class AjdeCoreBuildManager { if (propcp != null && propcp.length() != 0) { StringTokenizer st = new StringTokenizer(propcp, File.pathSeparator); List configClasspath = config.getClasspath(); - ArrayList toAdd = new ArrayList(); + ArrayList toAdd = new ArrayList<>(); while (st.hasMoreTokens()) { String entry = st.nextToken(); if (!configClasspath.contains(entry)) { @@ -280,7 +280,7 @@ public class AjdeCoreBuildManager { } } if (0 < toAdd.size()) { - ArrayList both = new ArrayList(configClasspath.size() + toAdd.size()); + ArrayList both = new ArrayList<>(configClasspath.size() + toAdd.size()); both.addAll(configClasspath); both.addAll(toAdd); config.setClasspath(both); @@ -376,7 +376,7 @@ public class AjdeCoreBuildManager { // Break a string into a string array of non-standard options. // Allows for one option to include a ' '. i.e. assuming it has been quoted, it // won't accidentally get treated as a pair of options (can be needed for xlint props file option) - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); int ind = nonStdOptions.indexOf('\"'); int ind2 = nonStdOptions.indexOf('\"', ind + 1); if ((ind > -1) && (ind2 > -1)) { // dont tokenize within double quotes @@ -404,7 +404,7 @@ public class AjdeCoreBuildManager { /** Local helper method for splitting option strings */ private List tokenizeString(String str) { - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); StringTokenizer tok = new StringTokenizer(str); while (tok.hasMoreTokens()) { tokens.add(tok.nextToken()); diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/AjdeCoreTestCase.java b/ajde.core/src/test/java/org/aspectj/ajde/core/AjdeCoreTestCase.java index c692d6d50..2d17fc41e 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/AjdeCoreTestCase.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/AjdeCoreTestCase.java @@ -139,7 +139,7 @@ public abstract class AjdeCoreTestCase extends TestCase { } public List getSourceFileList(String[] files) { - List sourceFiles = new ArrayList(); + List sourceFiles = new ArrayList<>(); for (String file : files) { sourceFiles.add(getAbsoluteProjectDir() + File.separator + file); } diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java b/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java index e214faeae..f732d2acb 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java @@ -28,7 +28,7 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { private String programmableString; private int count; - private List messagesReceived = new ArrayList(); + private List messagesReceived = new ArrayList<>(); private int currentVal; private boolean isCancelRequested = false; diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/TestCompilerConfiguration.java b/ajde.core/src/test/java/org/aspectj/ajde/core/TestCompilerConfiguration.java index e8432c8cf..d2081df15 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/TestCompilerConfiguration.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/TestCompilerConfiguration.java @@ -39,7 +39,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { private String outjar; private Map javaOptions; private String nonStandardOptions; - private List projectSourceFiles = new ArrayList(); + private List projectSourceFiles = new ArrayList<>(); private Map sourcePathResources; private String srcDirName = "src"; @@ -76,7 +76,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { public Map getJavaOptionsMap() { if (javaOptions == null) { - javaOptions = new Hashtable(); + javaOptions = new Hashtable<>(); javaOptions.put(JavaOptions.COMPLIANCE_LEVEL, JavaOptions.VERSION_13); javaOptions.put(JavaOptions.SOURCE_COMPATIBILITY_LEVEL, JavaOptions.VERSION_13); } @@ -111,7 +111,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { public Map getSourcePathResources() { if (sourcePathResources == null) { - sourcePathResources = new HashMap(); + sourcePathResources = new HashMap<>(); /* Allow the user to override the testProjectPath by using sourceRoots */ File[] srcBase = new File[] { new File(projectPath + File.separator + srcDirName) }; diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/TestMessageHandler.java b/ajde.core/src/test/java/org/aspectj/ajde/core/TestMessageHandler.java index 6cc8b8a8d..662971cfe 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/TestMessageHandler.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/TestMessageHandler.java @@ -29,9 +29,9 @@ public class TestMessageHandler implements IBuildMessageHandler { private List errors; public TestMessageHandler() { - ignoring = new ArrayList(); - messages = new ArrayList(); - errors = new ArrayList(); + ignoring = new ArrayList<>(); + messages = new ArrayList<>(); + errors = new ArrayList<>(); ignore(IMessage.INFO); ignore(IMessage.WEAVEINFO); } diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/TestOutputLocationManager.java b/ajde.core/src/test/java/org/aspectj/ajde/core/TestOutputLocationManager.java index 4249d2d56..6313dd4a2 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/TestOutputLocationManager.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/TestOutputLocationManager.java @@ -67,7 +67,7 @@ public class TestOutputLocationManager implements IOutputLocationManager { @Override public List getAllOutputLocations() { if (allOutputLocations == null) { - allOutputLocations = new ArrayList(); + allOutputLocations = new ArrayList<>(); initLocations(); allOutputLocations.add(classOutputLoc); if (!classOutputLoc.equals(resourceOutputLoc)) { diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/AjConfigTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/AjConfigTest.java index 15d2ff696..b32ea2623 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/AjConfigTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/AjConfigTest.java @@ -60,7 +60,7 @@ public class AjConfigTest extends AjdeCoreTestCase { } public void testAspectPath() { - Set aspects = new HashSet(); + Set aspects = new HashSet<>(); compilerConfig.setAspectPath(aspects); AjBuildConfig buildConfig = genAjBuildConfig(); List aPath = buildConfig.getAspectpath(); @@ -83,7 +83,7 @@ public class AjConfigTest extends AjdeCoreTestCase { } public void testInpath() { - Set jars = new HashSet(); + Set jars = new HashSet<>(); compilerConfig.setInpath(jars); AjBuildConfig buildConfig = genAjBuildConfig(); List inJars = buildConfig.getInpath(); @@ -130,7 +130,7 @@ public class AjConfigTest extends AjdeCoreTestCase { } public void testSourcePathResources() { - Map m = new HashMap(); + Map m = new HashMap<>(); m.put("newFile.txt", getWorkingDir()); compilerConfig.setSourcePathResources(m); AjBuildConfig buildConfig = genAjBuildConfig(); diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/DuplicateManifestTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/DuplicateManifestTest.java index b7c2a9251..c438715b7 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/DuplicateManifestTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/DuplicateManifestTest.java @@ -46,10 +46,10 @@ public class DuplicateManifestTest extends AjdeCoreTestCase { } public void testWeave() { - Set injars = new HashSet(); + Set injars = new HashSet<>(); injars.add(openFile(injarName)); compilerConfig.setInpath(injars); - Set aspectpath = new HashSet(); + Set aspectpath = new HashSet<>(); aspectpath.add(openFile(aspectjarName)); compilerConfig.setAspectPath(aspectpath); File outjar = openFile(outjarName); diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/InpathTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/InpathTest.java index 2d1b3fd7c..ee54cef96 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/InpathTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/InpathTest.java @@ -71,7 +71,7 @@ public class InpathTest extends AjdeCoreTestCase { * Expected result = output jar file contains contents of indir1 and class file for source that was in src */ public void testInpathToOutjar() { - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); File indir1 = openFile(indir1Name); inpath.add(indir1); compilerConfig.setInpath(inpath); @@ -83,7 +83,7 @@ public class InpathTest extends AjdeCoreTestCase { doBuild(true); assertTrue("Expected no compiler errors or warnings but found " + handler.getMessages(), handler.getMessages().isEmpty()); - Set expectedOutputJarContents = new HashSet(); + Set expectedOutputJarContents = new HashSet<>(); // From indir1 // If we don't copy resources, these next three files won't make it. // expectedOutputJarContents.add("META-INF/MANIFEST.MF"); @@ -100,7 +100,7 @@ public class InpathTest extends AjdeCoreTestCase { * */ public void testInpathToBin() { - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); File indir1 = openFile(indir1Name); inpath.add(indir1); compilerConfig.setInpath(inpath); @@ -109,7 +109,7 @@ public class InpathTest extends AjdeCoreTestCase { doBuild(true); assertTrue("Expected no compiler errors or warnings but found " + handler.getMessages(), handler.getMessages().isEmpty()); - Set expectedBindirContents = new HashSet(); + Set expectedBindirContents = new HashSet<>(); // From indir1 // If we don't copy resources, these next three files won't make it // expectedBindirContents.add("META-INF/MANIFEST.MF"); @@ -133,7 +133,7 @@ public class InpathTest extends AjdeCoreTestCase { * An extra check is done at the end of this test to verify that HelloWorld has changed size (due to the weaving). */ public void testInpathToOutjar2() { - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); File indir2 = openFile(indir2Name); inpath.add(indir2); compilerConfig.setInpath(inpath); @@ -145,7 +145,7 @@ public class InpathTest extends AjdeCoreTestCase { doBuild(true); assertTrue("Expected no compiler errors or warnings but found " + handler.getMessages(), handler.getMessages().isEmpty()); - Set expectedOutputJarContents = new HashSet(); + Set expectedOutputJarContents = new HashSet<>(); // From indir1 expectedOutputJarContents.add("example/HelloWorld.class"); @@ -181,7 +181,7 @@ public class InpathTest extends AjdeCoreTestCase { * */ public void testInpathAndInjarToBin() { - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); File indir2 = openFile(indir2Name); inpath.add(indir2); inpath.add(openFile(injarName)); @@ -191,7 +191,7 @@ public class InpathTest extends AjdeCoreTestCase { doBuild(true); assertTrue("Expected no compiler errors or warnings but found " + handler.getMessages(), handler.getMessages().isEmpty()); - Set expectedBindirContents = new HashSet(); + Set expectedBindirContents = new HashSet<>(); // From indir1 expectedBindirContents.add("example/HelloWorld.class"); diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/OutxmlTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/OutxmlTest.java index 7cf08b1c7..6434629bf 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/OutxmlTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/OutxmlTest.java @@ -112,7 +112,7 @@ public class OutxmlTest extends AjdeCoreTestCase { */ public void testOutxmlToOutjarWithAop_xml () { File f = new File( getAbsoluteProjectDir() + File.separator + "src-resources" + File.separator + "testjar.jar"); - Set roots = new HashSet(); + Set roots = new HashSet<>(); roots.add(f); compilerConfig.setInpath(roots); diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ResourceCopyTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ResourceCopyTest.java index 889e2e5ce..3176f1e31 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ResourceCopyTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ResourceCopyTest.java @@ -68,7 +68,7 @@ public class ResourceCopyTest extends AjdeCoreTestCase { } public void testInjarsToOutjar() { - Set injars = new HashSet(); + Set injars = new HashSet<>(); File injar1 = openFile(injar1Name); injars.add(injar1); compilerConfig.setInpath(injars); @@ -81,7 +81,7 @@ public class ResourceCopyTest extends AjdeCoreTestCase { } public void testDuplicateResources() { - Set injars = new HashSet(); + Set injars = new HashSet<>(); File injar1 = openFile(injar1Name); File injar2 = openFile(injar2Name); injars.add(injar1); @@ -110,7 +110,7 @@ public class ResourceCopyTest extends AjdeCoreTestCase { } public void testInjarsToBin() { - Set injars = new HashSet(); + Set injars = new HashSet<>(); File injar1 = openFile(injar1Name); injars.add(injar1); compilerConfig.setInpath(injars); @@ -133,7 +133,7 @@ public class ResourceCopyTest extends AjdeCoreTestCase { // } public void testInjarsToOutjarOddNames() { - Set injars = new HashSet(); + Set injars = new HashSet<>(); File injar1 = openFile("input1"); File outjar = openFile(outjarName + ".fozout"); injars.add(injar1); diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ReweavableTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ReweavableTest.java index 24723b253..c29f4ba21 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ReweavableTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ReweavableTest.java @@ -324,7 +324,7 @@ public class ReweavableTest extends AjdeCoreTestCase { Set paths = new HashSet<>(); paths.add(openFile(binDir)); compilerConfig.setInpath(paths); - compilerConfig.setProjectSourceFiles(new ArrayList()); + compilerConfig.setProjectSourceFiles(new ArrayList<>()); doBuild(true); String expMessage = "aspect tjp.GetInfo cannot be found when reweaving tjp.Demo"; @@ -356,7 +356,7 @@ public class ReweavableTest extends AjdeCoreTestCase { Set paths = new HashSet<>(); paths.add(openFile(binDir)); compilerConfig.setInpath(paths); - compilerConfig.setProjectSourceFiles(new ArrayList()); + compilerConfig.setProjectSourceFiles(new ArrayList<>()); doBuild(true); String expMessage = "successfully verified type tjp.GetInfo exists"; diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java index bc4263f4e..4e5a87882 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java @@ -202,10 +202,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { public void testWeaveMessagesBinaryAdvice() { if (debugTests) System.out.println("\ntestWeaveMessagesBinaryAdvice: Simple.jar + AspectAdvice.jar"); - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set aspectpath = new HashSet(); + Set aspectpath = new HashSet<>(); aspectpath.add(openFile("AspectAdvice.jar")); compilerConfig.setAspectPath(aspectpath); doBuild(); @@ -216,10 +216,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { public void testWeaveMessagesBinaryITD() { if (debugTests) System.out.println("\ntestWeaveMessagesBinaryITD: Simple.jar + AspectITD.jar"); - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set aspectpath = new HashSet(); + Set aspectpath = new HashSet<>(); aspectpath.add(openFile("AspectITD.jar")); compilerConfig.setAspectPath(aspectpath); doBuild(); @@ -230,10 +230,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { public void testWeaveMessagesBinaryDeclare() { if (debugTests) System.out.println("\ntestWeaveMessagesBinaryDeclare: Simple.jar + AspectDeclare.jar"); - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set aspectpath = new HashSet(); + Set aspectpath = new HashSet<>(); aspectpath.add(openFile("AspectDeclare.jar")); compilerConfig.setAspectPath(aspectpath); doBuild(); @@ -247,10 +247,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { public void testWeaveMessagesBinaryDeclareSoft() { if (debugTests) System.out.println("\ntestWeaveMessagesBinaryDeclareSoft: Simple.jar + AspectDeclareSoft.jar"); - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set aspectpath = new HashSet(); + Set aspectpath = new HashSet<>(); aspectpath.add(openFile("AspectDeclareSoft.jar")); compilerConfig.setAspectPath(aspectpath); doBuild(); @@ -261,10 +261,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { public void testWeaveMessagesBinaryAdviceInPackageFromJar() { if (debugTests) System.out.println("\ntestWeaveMessagesBinaryAdviceInPackageFromJar: Simple.jar + AspectInPackage.jar"); - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set aspectpath = new HashSet(); + Set aspectpath = new HashSet<>(); aspectpath.add(openFile("AspectInPackage.jar")); compilerConfig.setAspectPath(aspectpath); doBuild(); @@ -275,10 +275,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { public void testWeaveMessagesBinaryAdviceInPackage() { if (debugTests) System.out.println("\ntestWeaveMessagesBinaryAdviceInPackage: Simple.jar + AspectInPackage.jar"); - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set aspectpath = new HashSet(); + Set aspectpath = new HashSet<>(); aspectpath.add(openFile("pkg")); compilerConfig.setAspectPath(aspectpath); doBuild(); @@ -291,10 +291,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { public void testWeaveMessagesBinaryAdviceNoDebugInfo() { if (debugTests) System.out.println("\ntestWeaveMessagesBinaryAdvice: Simple.jar + AspectAdvice.jar"); - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); inpath.add(openFile("Simple_nodebug.jar")); compilerConfig.setInpath(inpath); - Set aspectpath = new HashSet(); + Set aspectpath = new HashSet<>(); aspectpath.add(openFile("AspectAdvice_nodebug.jar")); compilerConfig.setAspectPath(aspectpath); doBuild(); @@ -319,10 +319,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { public void testWeaveMessagesBinaryDeclareNoDebugInfo() { if (debugTests) System.out.println("\ntestWeaveMessagesBinaryDeclareNoDebugInfo: Simple.jar + AspectDeclare.jar"); - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); inpath.add(openFile("Simple_nodebug.jar")); compilerConfig.setInpath(inpath); - Set aspectpath = new HashSet(); + Set aspectpath = new HashSet<>(); aspectpath.add(openFile("AspectDeclare_nodebug.jar")); compilerConfig.setAspectPath(aspectpath); doBuild(); @@ -336,10 +336,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { public void testWeaveMessagesBinaryDeclareSoftNoDebugInfo() { if (debugTests) System.out.println("\ntestWeaveMessagesBinaryDeclareSoftNoDebugInfo: Simple.jar + AspectDeclareSoft.jar"); - Set inpath = new HashSet(); + Set inpath = new HashSet<>(); inpath.add(openFile("Simple_nodebug.jar")); compilerConfig.setInpath(inpath); - Set aspectpath = new HashSet(); + Set aspectpath = new HashSet<>(); aspectpath.add(openFile("AspectDeclareSoft_nodebug.jar")); compilerConfig.setAspectPath(aspectpath); doBuild(); diff --git a/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileParser.java b/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileParser.java index 7eb195716..9f0d1c818 100644 --- a/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileParser.java +++ b/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileParser.java @@ -24,8 +24,8 @@ import org.aspectj.ajdt.ajc.ConfigParser; */ public class LstBuildConfigFileParser extends ConfigParser { - private List importedFiles = new ArrayList(); - private List problemEntries = new ArrayList(); + private List importedFiles = new ArrayList<>(); + private List problemEntries = new ArrayList<>(); // private String currFilePath; diff --git a/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java b/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java index 4e59e5d74..4ca7316f4 100644 --- a/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java +++ b/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java @@ -100,7 +100,7 @@ class LstBuildConfigFileUpdater { null); Ajde.getDefault().getMessageHandler().handleMessage(msg); } - List fileContents = new ArrayList(); + List fileContents = new ArrayList<>(); BufferedReader reader = new BufferedReader(new FileReader(configFile)); String line = reader.readLine(); while (line != null) { @@ -146,13 +146,13 @@ class LstBuildConfigFileUpdater { ConfigParser configParser = new ConfigParser(); configParser.parseConfigFile(new File(path)); List files = configParser.getFiles(); - List relativeFiles = new ArrayList(); + List relativeFiles = new ArrayList<>(); for (File file : files) { relativeFiles.add(relativizePath(file.getPath(), rootPath)); } return relativeFiles; } catch (ConfigParser.ParseException pe) { - return new ArrayList(); + return new ArrayList<>(); } } diff --git a/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigManager.java b/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigManager.java index feda7df0c..cde164cc1 100644 --- a/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigManager.java +++ b/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigManager.java @@ -39,7 +39,7 @@ public class LstBuildConfigManager implements BuildConfigManager { private List allBuildConfigFiles; - private List listeners = new ArrayList(); + private List listeners = new ArrayList<>(); private LstBuildConfigFileUpdater fileUpdater = new LstBuildConfigFileUpdater(); protected String currConfigFilePath = null; @@ -63,8 +63,8 @@ public class LstBuildConfigManager implements BuildConfigManager { String rootPath = configFile.getParent(); String configFileName = configFile.getName(); BuildConfigModel model = new BuildConfigModel(configFilePath); - List configFiles = new ArrayList(); - List importedFiles = new ArrayList(); + List configFiles = new ArrayList<>(); + List importedFiles = new ArrayList<>(); List badEntries = null; try { LstBuildConfigFileParser configParser = new LstBuildConfigFileParser(configFilePath); @@ -134,7 +134,7 @@ public class LstBuildConfigManager implements BuildConfigManager { } private List relativizeFilePaths(List configFiles, String rootPath) { - List relativePathsList = new ArrayList(); + List relativePathsList = new ArrayList<>(); for (File file : configFiles) { relativePathsList.add(fileUpdater.relativizePath(file.getPath(), rootPath)); } @@ -308,7 +308,7 @@ public class LstBuildConfigManager implements BuildConfigManager { @Override public List getAllBuildConfigFiles() { if (allBuildConfigFiles == null) { - allBuildConfigFiles = new ArrayList(); + allBuildConfigFiles = new ArrayList<>(); if (getActiveConfigFile() != null) { allBuildConfigFiles.add(getActiveConfigFile()); } diff --git a/ajde/src/main/java/org/aspectj/ajde/ui/BuildConfigModel.java b/ajde/src/main/java/org/aspectj/ajde/ui/BuildConfigModel.java index 560766bf6..659ada21d 100644 --- a/ajde/src/main/java/org/aspectj/ajde/ui/BuildConfigModel.java +++ b/ajde/src/main/java/org/aspectj/ajde/ui/BuildConfigModel.java @@ -71,7 +71,7 @@ public class BuildConfigModel { } public List getActiveNodes(BuildConfigNode.Kind kind) { - List nodes = new ArrayList(); + List nodes = new ArrayList<>(); getActiveNodesHelper(root, kind, nodes); return nodes; } diff --git a/ajde/src/main/java/org/aspectj/ajde/ui/BuildConfigNode.java b/ajde/src/main/java/org/aspectj/ajde/ui/BuildConfigNode.java index 73e0bead0..06749bf23 100644 --- a/ajde/src/main/java/org/aspectj/ajde/ui/BuildConfigNode.java +++ b/ajde/src/main/java/org/aspectj/ajde/ui/BuildConfigNode.java @@ -33,7 +33,7 @@ public class BuildConfigNode { protected String name = ""; protected Kind kind; // children.listIterator() should support remove() operation - protected List children = new ArrayList(); + protected List children = new ArrayList<>(); protected IMessage message = null; protected ISourceLocation sourceLocation = null; @@ -78,7 +78,7 @@ public class BuildConfigNode { public void addChild(BuildConfigNode child) { if (children == null) { - children = new ArrayList(); + children = new ArrayList<>(); } children.add(child); child.setParent(this); @@ -86,7 +86,7 @@ public class BuildConfigNode { public void addChild(int position, BuildConfigNode child) { if (children == null) { - children = new ArrayList(); + children = new ArrayList<>(); } children.add(position, child); child.setParent(this); diff --git a/ajde/src/main/java/org/aspectj/ajde/ui/javaoptions/JavaDebugOptionsPanel.java b/ajde/src/main/java/org/aspectj/ajde/ui/javaoptions/JavaDebugOptionsPanel.java index 86f7a5025..0e7e09abc 100644 --- a/ajde/src/main/java/org/aspectj/ajde/ui/javaoptions/JavaDebugOptionsPanel.java +++ b/ajde/src/main/java/org/aspectj/ajde/ui/javaoptions/JavaDebugOptionsPanel.java @@ -103,7 +103,7 @@ public class JavaDebugOptionsPanel extends OptionsPanel { JComboBox debug = null; if (javaOptionToSet.equals(JavaOptions.PRESERVE_ALL_LOCALS)) { - debug = new JComboBox(preserveOptions); + debug = new JComboBox<>(preserveOptions); String value = javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet); if (value.equals(JavaOptions.PRESERVE)) { debug.setSelectedIndex(0); @@ -111,7 +111,7 @@ public class JavaDebugOptionsPanel extends OptionsPanel { debug.setSelectedIndex(1); } } else { - debug = new JComboBox(debugOptions); + debug = new JComboBox<>(debugOptions); String value = javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet); if (value.equals(JavaOptions.GENERATE)) { debug.setSelectedIndex(0); diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java index 44708bb01..41d13e37e 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java @@ -48,7 +48,7 @@ class HtmlDecorator { private static final String ITD_FIELD_SUMMARY = "Inter-Type Field Summary"; private static final String ITD_CONSTRUCTOR_SUMMARY = "Inter-Type Constructor Summary"; - static List visibleFileList = new ArrayList(); + static List visibleFileList = new ArrayList<>(); static Hashtable declIDTable = null; static File rootDir = null; static String docVisibilityModifier; @@ -295,9 +295,9 @@ class HtmlDecorator { } static void addAspectDocumentation(IProgramElement node, StringBuffer fileBuffer, int index) { - List pointcuts = new ArrayList(); - List advice = new ArrayList(); - List declares = new ArrayList(); + List pointcuts = new ArrayList<>(); + List advice = new ArrayList<>(); + List declares = new ArrayList<>(); List methodsDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.INTER_TYPE_METHOD); if (methodsDeclaredOn != null && !methodsDeclaredOn.isEmpty()) { insertDeclarationsSummary(fileBuffer, methodsDeclaredOn, ITD_METHOD_SUMMARY, index); diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java index 0f01a058f..2b2a24a26 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java @@ -86,13 +86,13 @@ public class Main implements Config { private static String outputWorkingDir = Config.WORKING_DIR; public static void clearState() { - options = new Vector(); - ajcOptions = new Vector(); - filenames = new Vector(); - fileList = new Vector(); - packageList = new Vector(); + options = new Vector<>(); + ajcOptions = new Vector<>(); + filenames = new Vector<>(); + fileList = new Vector<>(); + packageList = new Vector<>(); docModifier = "package"; - sourcepath = new Vector(); + sourcepath = new Vector<>(); verboseMode = false; packageMode = false; rootDir = null; @@ -170,7 +170,7 @@ public class Main implements Config { * package-summary properly. */ private static void packageHTML(AsmManager model, File[] inputFiles) throws IOException { - ArrayList dirList = new ArrayList(); + ArrayList dirList = new ArrayList<>(); for (File inputFile : inputFiles) { String packageName = StructureUtil.getPackageDeclarationFromFile(model, inputFile); // Only copy the package.html file once. @@ -239,7 +239,7 @@ public class Main implements Config { System.out.println("> Calling javadoc..."); String[] javadocargs = null; - List files = new ArrayList(); + List files = new ArrayList<>(); if (packageMode) { int numExtraArgs = 2; if (authorStandardDocletSwitch) @@ -268,7 +268,7 @@ public class Main implements Config { javadocargs[numExtraArgs + options.size() + packageList.size() + k] = fileList.elementAt(k); } if (LangUtil.is19VMOrGreater()) { - options = new Vector(); + options = new Vector<>(); for (String a: javadocargs) { options.add(a); } @@ -362,7 +362,7 @@ public class Main implements Config { } static Vector getSourcePath() { - Vector sourcePath = new Vector(); + Vector sourcePath = new Vector<>(); boolean found = false; for (int i = 0; i < options.size(); i++) { String currOption = options.elementAt(i); @@ -471,7 +471,7 @@ public class Main implements Config { String line = ""; line = br.readLine(); StringTokenizer st = new StringTokenizer(line, " "); - List argList = new ArrayList(); + List argList = new ArrayList<>(); while (st.hasMoreElements()) { argList.add(st.nextToken()); } @@ -490,7 +490,7 @@ public class Main implements Config { ioe.printStackTrace(); } } - List vargs = new LinkedList(Arrays.asList(args)); + List vargs = new LinkedList<>(Arrays.asList(args)); vargs.add("-Xset:minimalModel=false"); parseArgs(vargs, new File(".")); // !!! @@ -722,7 +722,7 @@ public class Main implements Config { } static void expandAtSignFile(String filename, File currentWorkingDir) { - List result = new LinkedList(); + List result = new LinkedList<>(); File atFile = qualifiedFile(filename, currentWorkingDir); String atFileParent = atFile.getParent(); diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StructureUtil.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StructureUtil.java index 2fdd95698..d4cdb9cd5 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StructureUtil.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StructureUtil.java @@ -42,7 +42,7 @@ public class StructureUtil { * @return null if a relationship of that kind is not found */ public static List getTargets(IProgramElement node, IRelationship.Kind kind, String relName) { - List relations = new ArrayList(); + List relations = new ArrayList<>(); List rels = node.getModel().getRelationshipMap().get(node); if (rels != null) { relations.addAll(rels); @@ -64,7 +64,7 @@ public class StructureUtil { } if (relations == null || relations.isEmpty()) return null; - List targets = new ArrayList(); + List targets = new ArrayList<>(); for (IRelationship rtn : relations) { if (rtn.getKind().equals(kind) && ((relName != null && relName.equals(rtn.getName())) || relName == null)) { List targs = rtn.getTargets(); @@ -79,7 +79,7 @@ public class StructureUtil { } static List getDeclareInterTypeTargets(IProgramElement node, IProgramElement.Kind kind) { - List targets = new ArrayList(); + List targets = new ArrayList<>(); List stringTargets = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE_INTER_TYPE); if (stringTargets == null) { return null; diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java index 797c76660..431018401 100644 --- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java +++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java @@ -60,7 +60,7 @@ public class AjdocOutputChecker { * @throws Exception */ public static List getMissingStringsInFile(File htmlFile, String[] requiredStrings) throws Exception { - List missingStrings = new ArrayList(); + List missingStrings = new ArrayList<>(); for (String string : requiredStrings) { if (!containsString(htmlFile, string)) { missingStrings.add(string); @@ -120,7 +120,7 @@ public class AjdocOutputChecker { */ public static List getMissingStringsInSection(File htmlFile, String[] requiredStrings, String sectionHeader) throws Exception { - List missingStrings = new ArrayList(); + List missingStrings = new ArrayList<>(); for (String string : requiredStrings) { if (!containsStringWithinSection(htmlFile, string, sectionHeader)) { missingStrings.add(string); diff --git a/asm/src/main/java/org/aspectj/asm/AsmManager.java b/asm/src/main/java/org/aspectj/asm/AsmManager.java index b8a8989cb..dc766eb7f 100644 --- a/asm/src/main/java/org/aspectj/asm/AsmManager.java +++ b/asm/src/main/java/org/aspectj/asm/AsmManager.java @@ -73,7 +73,7 @@ public class AsmManager implements IStructureModel { private static boolean completingTypeBindings = false; - private final List structureListeners = new ArrayList(); + private final List structureListeners = new ArrayList<>(); // The model is 'manipulated' by the AjBuildManager.setupModel() code which // trashes all the @@ -95,10 +95,10 @@ public class AsmManager implements IStructureModel { private final CanonicalFilePathMap canonicalFilePathMap = new CanonicalFilePathMap(); // Record the Set for which the model has been modified during the // last incremental build - private final Set lastBuildChanges = new HashSet(); + private final Set lastBuildChanges = new HashSet<>(); // Record the Set of aspects that wove the files listed in lastBuildChanges - final Set aspectsWeavingInLastBuild = new HashSet(); + final Set aspectsWeavingInLastBuild = new HashSet<>(); // static { // setReporting("c:/model.nfo",true,true,true,true); @@ -149,16 +149,16 @@ public class AsmManager implements IStructureModel { return null; } - HashMap> annotations = new HashMap>(); + HashMap> annotations = new HashMap<>(); IProgramElement node = hierarchy.findElementForSourceFile(sourceFile); if (node == IHierarchy.NO_STRUCTURE) { return null; } else { IProgramElement fileNode = node; - ArrayList peNodes = new ArrayList(); + ArrayList peNodes = new ArrayList<>(); getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType); for (IProgramElement peNode : peNodes) { - List entries = new ArrayList(); + List entries = new ArrayList<>(); entries.add(peNode); ISourceLocation sourceLoc = peNode.getSourceLocation(); if (null != sourceLoc) { @@ -296,7 +296,7 @@ public class AsmManager implements IStructureModel { private static class CanonicalFilePathMap { private static final int MAX_SIZE = 4000; - private final Map pathMap = new HashMap(20); + private final Map pathMap = new HashMap<>(20); // // guards to ensure correctness and liveness // private boolean cacheInUse = false; @@ -549,7 +549,7 @@ public class AsmManager implements IStructureModel { boolean modelModified = false; - Set deletedNodes = new HashSet(); + Set deletedNodes = new HashSet<>(); for (File fileForCompilation : files) { String correctedPath = getCanonicalFilePath(fileForCompilation); IProgramElement progElem = (IProgramElement) hierarchy.findInFileMap(correctedPath); @@ -690,15 +690,15 @@ public class AsmManager implements IStructureModel { return; } - Set sourcesToRemove = new HashSet(); - Map handleToTypenameCache = new HashMap(); + Set sourcesToRemove = new HashSet<>(); + Map handleToTypenameCache = new HashMap<>(); // Iterate over the source handles in the relationships map, the aim // here is to remove any 'affected by' // relationships where the source of the relationship is the specified // type (since it will be readded // when the type is woven) Set sourcehandlesSet = mapper.getEntries(); - List relationshipsToRemove = new ArrayList(); + List relationshipsToRemove = new ArrayList<>(); for (String hid : sourcehandlesSet) { if (isPhantomHandle(hid)) { // inpath handle - but for which type? @@ -780,7 +780,7 @@ public class AsmManager implements IStructureModel { continue; } List targets = rel.getTargets(); - List targetsToRemove = new ArrayList(); + List targetsToRemove = new ArrayList<>(); // find targets that target the type we are interested in, // they need removing @@ -928,8 +928,8 @@ public class AsmManager implements IStructureModel { // Now sort out the relationships map // IRelationshipMap irm = AsmManager.getDefault().getRelationshipMap(); - Set sourcesToRemove = new HashSet(); - Set nonExistingHandles = new HashSet(); // Cache of handles that we + Set sourcesToRemove = new HashSet<>(); + Set nonExistingHandles = new HashSet<>(); // Cache of handles that we // *know* are invalid // int srchandlecounter = 0; // int tgthandlecounter = 0; @@ -956,12 +956,12 @@ public class AsmManager implements IStructureModel { } else { // Ok, so the source is valid, what about the targets? List relationships = mapper.get(hid); - List relationshipsToRemove = new ArrayList(); + List relationshipsToRemove = new ArrayList<>(); // Iterate through the relationships against this source // handle for (IRelationship rel : relationships) { List targets = rel.getTargets(); - List targetsToRemove = new ArrayList(); + List targetsToRemove = new ArrayList<>(); // Iterate through the targets for this relationship for (String targethid : targets) { @@ -1168,7 +1168,7 @@ public class AsmManager implements IStructureModel { * A ModelInfo object captures basic information about the structure model. It is used for testing and producing debug info. */ public static class ModelInfo { - private final Hashtable nodeTypeCount = new Hashtable(); + private final Hashtable nodeTypeCount = new Hashtable<>(); private final Properties extraProperties = new Properties(); private ModelInfo(IHierarchy hierarchy, IRelationshipMap relationshipMap) { diff --git a/asm/src/main/java/org/aspectj/asm/IProgramElement.java b/asm/src/main/java/org/aspectj/asm/IProgramElement.java index 402376217..8d4766681 100644 --- a/asm/src/main/java/org/aspectj/asm/IProgramElement.java +++ b/asm/src/main/java/org/aspectj/asm/IProgramElement.java @@ -349,7 +349,7 @@ public interface IProgramElement extends Serializable { } public static List getNonAJMemberKinds() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add(METHOD); list.add(ENUM_VALUE); list.add(FIELD); diff --git a/asm/src/main/java/org/aspectj/asm/internal/AspectJElementHierarchy.java b/asm/src/main/java/org/aspectj/asm/internal/AspectJElementHierarchy.java index 6019964c6..869affd91 100644 --- a/asm/src/main/java/org/aspectj/asm/internal/AspectJElementHierarchy.java +++ b/asm/src/main/java/org/aspectj/asm/internal/AspectJElementHierarchy.java @@ -43,7 +43,7 @@ public class AspectJElementHierarchy implements IHierarchy { // Access to the handleMap and typeMap are now synchronized - at least the find methods and the updateHandleMap function // see pr305788 private Map fileMap = null; - private Map handleMap = new HashMap(); + private Map handleMap = new HashMap<>(); private Map typeMap = null; public AspectJElementHierarchy(AsmManager asm) { @@ -84,8 +84,8 @@ public class AspectJElementHierarchy implements IHierarchy { public void setRoot(IProgramElement root) { this.root = root; - handleMap = new HashMap(); - typeMap = new HashMap(); + handleMap = new HashMap<>(); + typeMap = new HashMap<>(); } public void addToFileMap(String key, IProgramElement value) { @@ -230,7 +230,7 @@ public class AspectJElementHierarchy implements IHierarchy { if ((children.get(0)).getKind() == IProgramElement.Kind.SOURCE_FOLDER) { String searchPackageName = (packagename == null ? "" : packagename); // default package means match on "" // dealing with source folders - List matchingPackageNodes = new ArrayList(); + List matchingPackageNodes = new ArrayList<>(); for (IProgramElement sourceFolder : children) { List possiblePackageNodes = sourceFolder.getChildren(); for (IProgramElement possiblePackageNode : possiblePackageNodes) { @@ -248,11 +248,11 @@ public class AspectJElementHierarchy implements IHierarchy { // thing to return in the list if (packagename == null) { // default package - List result = new ArrayList(); + List result = new ArrayList<>(); result.add(root); return result; } - List result = new ArrayList(); + List result = new ArrayList<>(); for (IProgramElement possiblePackage : children) { if (possiblePackage.getKind() == IProgramElement.Kind.PACKAGE && possiblePackage.getName().equals(packagename)) { result.add(possiblePackage); @@ -643,7 +643,7 @@ public class AspectJElementHierarchy implements IHierarchy { // TODO rename this method ... it does more than just the handle map public void updateHandleMap(Set deletedFiles) { // Only delete the entries we need to from the handle map - for performance reasons - List forRemoval = new ArrayList(); + List forRemoval = new ArrayList<>(); Set k = null; synchronized (this) { k = handleMap.keySet(); diff --git a/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java b/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java index 9842830cb..8c13747be 100644 --- a/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java +++ b/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java @@ -223,7 +223,7 @@ public class ProgramElement implements IProgramElement { } private static List genModifiers(int modifiers) { - List modifiersList = new ArrayList(); + List modifiersList = new ArrayList<>(); if ((modifiers & AccStatic) != 0) { modifiersList.add(IProgramElement.Modifiers.STATIC); } @@ -551,7 +551,7 @@ public class ProgramElement implements IProgramElement { public void addChild(IProgramElement child) { if (children == null || children == Collections.EMPTY_LIST) { - children = new ArrayList(); + children = new ArrayList<>(); } children.add(child); child.setParent(this); @@ -559,7 +559,7 @@ public class ProgramElement implements IProgramElement { public void addChild(int position, IProgramElement child) { if (children == null || children == Collections.EMPTY_LIST) { - children = new ArrayList(); + children = new ArrayList<>(); } children.add(position, child); child.setParent(this); @@ -750,7 +750,7 @@ public class ProgramElement implements IProgramElement { if (l == null || l.isEmpty()) { return Collections.emptyList(); } - List params = new ArrayList(); + List params = new ArrayList<>(); for (char[] param : l) { params.add(NameConvertor.convertFromSignature(param)); } @@ -805,7 +805,7 @@ public class ProgramElement implements IProgramElement { private void fixMap() { if (kvpairs == Collections.EMPTY_MAP) { - kvpairs = new HashMap(); + kvpairs = new HashMap<>(); } } diff --git a/asm/src/main/java/org/aspectj/asm/internal/RelationshipMap.java b/asm/src/main/java/org/aspectj/asm/internal/RelationshipMap.java index 0df2fdd89..5a5e18b46 100644 --- a/asm/src/main/java/org/aspectj/asm/internal/RelationshipMap.java +++ b/asm/src/main/java/org/aspectj/asm/internal/RelationshipMap.java @@ -55,8 +55,8 @@ public class RelationshipMap extends HashMap> implem if (!createIfMissing) { return null; } - relationships = new ArrayList(); - IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList(), runtimeTest); + relationships = new ArrayList<>(); + IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<>(), runtimeTest); relationships.add(rel); super.put(source, relationships); @@ -70,7 +70,7 @@ public class RelationshipMap extends HashMap> implem if (createIfMissing) { // At this point we did find some relationships for 'source' but not one that looks like what we are // after (either the kind or the name or the dynamictests setting don't match) - IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList(), runtimeTest); + IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<>(), runtimeTest); relationships.add(rel); return rel; } @@ -112,7 +112,7 @@ public class RelationshipMap extends HashMap> implem List existingRelationships = super.get(source); if (existingRelationships == null) { // new entry - existingRelationships = new ArrayList(); + existingRelationships = new ArrayList<>(); existingRelationships.add(relationship); super.put(source, existingRelationships); } else { diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java index de8f9c650..4609a3e09 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java @@ -71,9 +71,9 @@ public class ConstantPool implements Node { private Constant[] pool; private int poolSize; // number of entries in the pool (could be < pool.length as the array is resized in 'chunks') - private Map utf8Cache = new HashMap(); - private Map methodCache = new HashMap(); - private Map fieldCache = new HashMap(); + private Map utf8Cache = new HashMap<>(); + private Map methodCache = new HashMap<>(); + private Map fieldCache = new HashMap<>(); public int getSize() { return poolSize; diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/FieldOrMethod.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/FieldOrMethod.java index 8689e31b9..f0fc8c5a7 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/FieldOrMethod.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/FieldOrMethod.java @@ -167,7 +167,7 @@ public abstract class FieldOrMethod extends Modifiers implements Node { // remain there. if (annotations == null) { // Find attributes that contain annotation data - List accumulatedAnnotations = new ArrayList(); + List accumulatedAnnotations = new ArrayList<>(); for (Attribute attribute : attributes) { if (attribute instanceof RuntimeAnnos) { RuntimeAnnos runtimeAnnotations = (RuntimeAnnos) attribute; diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java index 59c092239..dd1097ff0 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java @@ -286,7 +286,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node { public AnnotationGen[] getAnnotations() { if (annotationsOutOfDate) { // Find attributes that contain annotation data - List accumulatedAnnotations = new ArrayList(); + List accumulatedAnnotations = new ArrayList<>(); for (Attribute attribute : attributes) { if (attribute instanceof RuntimeAnnos) { RuntimeAnnos runtimeAnnotations = (RuntimeAnnos) attribute; @@ -742,7 +742,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node { */ public JavaClass[] getSuperClasses() { JavaClass clazz = this; - List vec = new ArrayList(); + List vec = new ArrayList<>(); for (clazz = clazz.getSuperClass(); clazz != null; clazz = clazz.getSuperClass()) { vec.add(clazz); } @@ -772,8 +772,8 @@ public class JavaClass extends Modifiers implements Cloneable, Node { * Get all interfaces implemented by this JavaClass (transitively). */ public Collection getAllInterfaces() { - Queue queue = new LinkedList(); - List interfaceList = new ArrayList(); + Queue queue = new LinkedList<>(); + List interfaceList = new ArrayList<>(); queue.add(this); diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java index baa0629c6..12608940a 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java @@ -223,7 +223,7 @@ public final class Method extends FieldOrMethod { boolean foundSome = false; // Build a list of annotation arrays, one per argument if (parameterAnnotationsInvis != null || parameterAnnotationsVis != null) { - List annotationsForEachParameter = new ArrayList(); + List annotationsForEachParameter = new ArrayList<>(); AnnotationGen[] visibleOnes = null; AnnotationGen[] invisibleOnes = null; for (int i = 0; i < parameterCount; i++) { diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java index 9168847b0..71573a311 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java @@ -606,7 +606,7 @@ public abstract class Utility { riaIndex = cp.addUtf8("RuntimeInvisibleAnnotations"); } - List newAttributes = new ArrayList(); + List newAttributes = new ArrayList<>(); if (rvaData.length > 2) { newAttributes.add(new RuntimeVisAnnos(rvaIndex, rvaData.length, rvaData, cp)); } @@ -699,7 +699,7 @@ public abstract class Utility { riaIndex = cp.addUtf8("RuntimeInvisibleParameterAnnotations"); } - List newAttributes = new ArrayList(); + List newAttributes = new ArrayList<>(); if (totalVisCount > 0) { newAttributes.add(new RuntimeVisParamAnnos(rvaIndex, rvaData.length, rvaData, cp)); diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java index 8074e383e..8418abdb8 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java @@ -44,7 +44,7 @@ public class AnnotationGen { } private List copyValues(List in, ConstantPool cpool, boolean copyPoolEntries) { - List out = new ArrayList(); + List out = new ArrayList<>(); for (NameValuePair nvp : in) { out.add(new NameValuePair(nvp, cpool, copyPoolEntries)); } @@ -89,7 +89,7 @@ public class AnnotationGen { public void addElementNameValuePair(NameValuePair evp) { if (pairs == Collections.EMPTY_LIST) { - pairs = new ArrayList(); + pairs = new ArrayList<>(); } pairs.add(evp); } diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java index ecb1d539d..e18174410 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java @@ -34,13 +34,13 @@ public abstract class RuntimeAnnos extends Attribute { public RuntimeAnnos(byte attrid, boolean visible, int nameIdx, int len, ConstantPool cpool) { super(attrid, nameIdx, len, cpool); this.visible = visible; - annotations = new ArrayList(); + annotations = new ArrayList<>(); } public RuntimeAnnos(byte attrid, boolean visible, int nameIdx, int len, byte[] data, ConstantPool cpool) { super(attrid, nameIdx, len, cpool); this.visible = visible; - annotations = new ArrayList(); + annotations = new ArrayList<>(); annotation_data = data; } @@ -76,7 +76,7 @@ public abstract class RuntimeAnnos extends Attribute { DataInputStream dis = new DataInputStream(new ByteArrayInputStream(annotation_data)); int numberOfAnnotations = dis.readUnsignedShort(); if (numberOfAnnotations > 0) { - List inflatedAnnotations = new ArrayList(); + List inflatedAnnotations = new ArrayList<>(); for (int i = 0; i < numberOfAnnotations; i++) { inflatedAnnotations.add(AnnotationGen.read(dis, getConstantPool(), visible)); } diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java index 42bf903a1..5b1dcafff 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java @@ -36,13 +36,13 @@ public abstract class RuntimeParamAnnos extends Attribute { int nameIdx, int len, ConstantPool cpool) { super(attrid,nameIdx,len,cpool); this.visible = visible; - parameterAnnotations = new ArrayList(); + parameterAnnotations = new ArrayList<>(); } public RuntimeParamAnnos(byte attrid,boolean visible,int nameIdx,int len,byte[] data,ConstantPool cpool) { super(attrid,nameIdx,len,cpool); this.visible = visible; - parameterAnnotations = new ArrayList(); + parameterAnnotations = new ArrayList<>(); annotation_data = data; } @@ -88,7 +88,7 @@ public abstract class RuntimeParamAnnos extends Attribute { DataInputStream dis = new DataInputStream(new ByteArrayInputStream(annotation_data)); int numParameters = dis.readUnsignedByte(); if (numParameters > 0) { - List inflatedParameterAnnotations = new ArrayList(); + List inflatedParameterAnnotations = new ArrayList<>(); for (int i=0; i fieldsList = new ArrayList(); - private List methodsList = new ArrayList(); - private List attributesList = new ArrayList(); - private List interfaceList = new ArrayList(); - private List annotationsList = new ArrayList(); + private List fieldsList = new ArrayList<>(); + private List methodsList = new ArrayList<>(); + private List attributesList = new ArrayList<>(); + private List interfaceList = new ArrayList<>(); + private List annotationsList = new ArrayList<>(); public ClassGen(String classname, String superclassname, String filename, int modifiers, String[] interfacenames, ConstantPool cpool) { @@ -187,7 +187,7 @@ public class ClassGen extends Modifiers implements Cloneable { attributes = attributesList; } else { // TODO: Sometime later, trash any attributes called 'RuntimeVisibleAnnotations' or 'RuntimeInvisibleAnnotations' - attributes = new ArrayList(); + attributes = new ArrayList<>(); attributes.addAll(Utility.getAnnotationAttributes(cpool, annotationsList)); attributes.addAll(attributesList); } @@ -503,7 +503,7 @@ public class ClassGen extends Modifiers implements Cloneable { // (relevant modifiers are ACC_PUBLIC, ACC_PRIVATE, // ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_VOLATILE, // ACC_TRANSIENT) - List relevantFields = new ArrayList(); + List relevantFields = new ArrayList<>(); for (Field field : fieldsList) { if (!(field.isPrivate() && field.isStatic()) && !(field.isPrivate() && field.isTransient())) { relevantFields.add(field); @@ -519,8 +519,8 @@ public class ClassGen extends Modifiers implements Cloneable { } // some up front method processing: discover clinit, init and ordinary methods of interest: - List relevantMethods = new ArrayList(); - List relevantCtors = new ArrayList(); + List relevantMethods = new ArrayList<>(); + List relevantCtors = new ArrayList<>(); boolean hasClinit = false; for (Method m : methodsList) { boolean couldBeInitializer = m.getName().charAt(0) == '<'; diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java index ff8b6f42c..c8e1fe2fb 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java @@ -76,8 +76,8 @@ public abstract class FieldGenOrMethodGen extends Modifiers { protected String name; protected Type type; protected ConstantPool cp; - private ArrayList attributeList = new ArrayList(); - protected ArrayList annotationList = new ArrayList(); + private ArrayList attributeList = new ArrayList<>(); + protected ArrayList annotationList = new ArrayList<>(); protected FieldGenOrMethodGen() { } diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionHandle.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionHandle.java index 2f2691df1..c5c244869 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionHandle.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionHandle.java @@ -156,7 +156,7 @@ public class InstructionHandle implements java.io.Serializable { */ public void addTargeter(InstructionTargeter t) { if (targeters == Collections.EMPTY_SET) { - targeters = new HashSet(); + targeters = new HashSet<>(); } targeters.add(t); } @@ -170,7 +170,7 @@ public class InstructionHandle implements java.io.Serializable { } public Set getTargetersCopy() { - Set copy = new HashSet(); + Set copy = new HashSet<>(); copy.addAll(targeters); return copy; } diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java index dd010b758..156adf0ad 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java @@ -690,7 +690,7 @@ public class InstructionList implements Serializable { return; } - ArrayList target_vec = new ArrayList(); + ArrayList target_vec = new ArrayList<>(); for (InstructionHandle ih = first; ih != null; ih = ih.next) { ih.getInstruction().dispose(); // e.g. BranchInstructions release their targets @@ -1003,7 +1003,7 @@ public class InstructionList implements Serializable { */ public Instruction[] getInstructions() { ByteSequence bytes = new ByteSequence(getByteCode()); - ArrayList instructions = new ArrayList(); + ArrayList instructions = new ArrayList<>(); try { while (bytes.available() > 0) { @@ -1089,7 +1089,7 @@ public class InstructionList implements Serializable { * @return complete, i.e., deep copy of this list */ public InstructionList copy() { - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); InstructionList il = new InstructionList(); /* diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java index 46b558146..cf8c06834 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java @@ -103,11 +103,11 @@ public class MethodGen extends FieldGenOrMethodGen { private int highestLineNumber = 0; - private ArrayList localVariablesList = new ArrayList(); - private ArrayList lineNumbersList = new ArrayList(); - private ArrayList exceptionsList = new ArrayList(); - private ArrayList exceptionsThrown = new ArrayList(); - private ArrayList codeAttributesList = new ArrayList(); + private ArrayList localVariablesList = new ArrayList<>(); + private ArrayList lineNumbersList = new ArrayList<>(); + private ArrayList exceptionsList = new ArrayList<>(); + private ArrayList exceptionsThrown = new ArrayList<>(); + private ArrayList codeAttributesList = new ArrayList<>(); private List[] param_annotations; // Array of lists containing AnnotationGen objects private boolean hasParameterAnnotations = false; private boolean haveUnpackedParameterAnnotations = false; @@ -933,8 +933,8 @@ public class MethodGen extends FieldGenOrMethodGen { } static final class BranchStack { - Stack branchTargets = new Stack(); - Hashtable visitedTargets = new Hashtable(); + Stack branchTargets = new Stack<>(); + Hashtable visitedTargets = new Hashtable<>(); public void push(InstructionHandle target, int stackDepth) { if (visited(target)) { @@ -1106,7 +1106,7 @@ public class MethodGen extends FieldGenOrMethodGen { if (!hasParameterAnnotations) { param_annotations = new List[parameterTypes.length]; for (int j = 0; j < parameterTypes.length; j++) { - param_annotations[j] = new ArrayList(); + param_annotations[j] = new ArrayList<>(); } } @@ -1139,7 +1139,7 @@ public class MethodGen extends FieldGenOrMethodGen { } private List /* AnnotationGen */ makeMutableVersion(AnnotationGen[] mutableArray) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (AnnotationGen annotationGen : mutableArray) { result.add(new AnnotationGen(annotationGen, getConstantPool(), false)); } @@ -1156,7 +1156,7 @@ public class MethodGen extends FieldGenOrMethodGen { if (existingAnnotations != null) { existingAnnotations.add(annotation); } else { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add(annotation); param_annotations[parameterIndex] = l; } diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java index 68b68f3d6..ed8995ef0 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java @@ -113,7 +113,7 @@ public abstract class Type { public static final Type[] STRINGARRAY6 = new Type[] { STRING, STRING, STRING, STRING, STRING, STRING }; public static final Type[] STRINGARRAY7 = new Type[] { STRING, STRING, STRING, STRING, STRING, STRING, STRING }; - private static Map commonTypes = new HashMap(); + private static Map commonTypes = new HashMap<>(); static { commonTypes.put(STRING.getSignature(), STRING); @@ -314,7 +314,7 @@ public abstract class Type { */ // OPTIMIZE crap impl public static Type[] getArgumentTypes(String signature) { - List argumentTypes = new ArrayList(); + List argumentTypes = new ArrayList<>(); int index; Type[] types; diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java index e3c59556b..4f18bd70f 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java @@ -88,8 +88,8 @@ public class ClassLoaderRepository implements Repository { private ClassLoaderReference loaderRef; // Choice of cache... - private WeakHashMap> localCache = new WeakHashMap>(); - private static SoftHashMap /* */sharedCache = new SoftHashMap(Collections.synchronizedMap(new HashMap())); + private WeakHashMap> localCache = new WeakHashMap<>(); + private static SoftHashMap /* */sharedCache = new SoftHashMap(Collections.synchronizedMap(new HashMap<>())); // For fast translation of the classname *intentionally not static* private SoftHashMap /* */nameMap = new SoftHashMap(new HashMap(), false); @@ -216,7 +216,7 @@ public class ClassLoaderRepository implements Repository { sharedCache.put(url, clazz); } else { clazz.setRepository(this); - localCache.put(url, new SoftReference(clazz)); + localCache.put(url, new SoftReference<>(clazz)); } } diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java index 95552dd6a..179800540 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java @@ -106,7 +106,7 @@ public class ClassPath implements Serializable { public ClassPath(String class_path) { this.class_path = class_path; - ArrayList vec = new ArrayList(); + ArrayList vec = new ArrayList<>(); for (StringTokenizer tok = new StringTokenizer(class_path, System.getProperty("path.separator")); tok .hasMoreTokens();) { @@ -193,12 +193,12 @@ public class ClassPath implements Serializable { String ext_path = System.getProperty("java.ext.dirs"); String vm_version = System.getProperty("java.version"); - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); getPathComponents(class_path, list); getPathComponents(boot_path, list); - ArrayList dirs = new ArrayList(); + ArrayList dirs = new ArrayList<>(); getPathComponents(ext_path, dirs); for (String string : dirs) { diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/NonCachingClassLoaderRepository.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/NonCachingClassLoaderRepository.java index fe43a7bef..a7689b108 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/NonCachingClassLoaderRepository.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/NonCachingClassLoaderRepository.java @@ -96,7 +96,7 @@ public class NonCachingClassLoaderRepository implements Repository { } public SoftHashMap() { - this(new HashMap()); + this(new HashMap<>()); } public SoftHashMap(Map map, boolean b) { diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/SyntheticRepository.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/SyntheticRepository.java index ea0e49216..baf3b75cd 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/SyntheticRepository.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/SyntheticRepository.java @@ -80,12 +80,12 @@ import org.aspectj.apache.bcel.classfile.JavaClass; public class SyntheticRepository implements Repository { private static final String DEFAULT_PATH = ClassPath.getClassPath(); - private static HashMap _instances = new HashMap(); // CLASSPATH + private static HashMap _instances = new HashMap<>(); // CLASSPATH // X // REPOSITORY private ClassPath _path = null; - private WeakHashMap _loadedClasses = new WeakHashMap(); // CLASSNAME X JAVACLASS + private WeakHashMap _loadedClasses = new WeakHashMap<>(); // CLASSNAME X JAVACLASS private SyntheticRepository(ClassPath path) { _path = path; diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java index d9a4ce780..d684144eb 100644 --- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java +++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java @@ -64,7 +64,7 @@ public class AnnotationGenTest extends BcelTestCase { ObjectType t = new ObjectType("SimpleAnnotation"); - List elements = new ArrayList(); + List elements = new ArrayList<>(); elements.add(nvGen); // Build an annotation of type 'SimpleAnnotation' with 'id=4' as the only value :) @@ -91,13 +91,13 @@ public class AnnotationGenTest extends BcelTestCase { ObjectType t = new ObjectType("SimpleAnnotation"); - List elements = new ArrayList(); + List elements = new ArrayList<>(); elements.add(nvGen); // Build a RV annotation of type 'SimpleAnnotation' with 'id=4' as the only value :) AnnotationGen a = new AnnotationGen(t, elements, true, cp); - Vector v = new Vector(); + Vector v = new Vector<>(); v.add(a); Collection attributes = Utility.getAnnotationAttributes(cp, v); boolean foundRV = false; @@ -113,7 +113,7 @@ public class AnnotationGenTest extends BcelTestCase { // Build a RIV annotation of type 'SimpleAnnotation' with 'id=4' as the only value :) AnnotationGen a2 = new AnnotationGen(t, elements, false, cp); - Vector v2 = new Vector(); + Vector v2 = new Vector<>(); v2.add(a2); Collection attributes2 = Utility.getAnnotationAttributes(cp, v2); boolean foundRIV = false; diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java index 57505a9c5..b18d51308 100644 --- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java +++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java @@ -93,7 +93,7 @@ public abstract class BcelTestCase extends TestCase { protected Attribute[] findAttribute(String name, JavaClass clazz) { Attribute[] all = clazz.getAttributes(); - List chosenAttrsList = new ArrayList(); + List chosenAttrsList = new ArrayList<>(); for (Attribute attribute : all) { if (verbose) System.err.println("Attribute: " + attribute.getName()); @@ -104,7 +104,7 @@ public abstract class BcelTestCase extends TestCase { } protected Attribute findAttribute(String name, Attribute[] all) { - List chosenAttrsList = new ArrayList(); + List chosenAttrsList = new ArrayList<>(); for (Attribute attribute : all) { if (verbose) System.err.println("Attribute: " + attribute.getName()); @@ -158,7 +158,7 @@ public abstract class BcelTestCase extends TestCase { SimpleElementValue evg = new SimpleElementValue(ElementValue.STRING, cp, aFruit); NameValuePair nvGen = new NameValuePair("fruit", evg, cp); ObjectType t = new ObjectType("SimpleStringAnnotation"); - List elements = new ArrayList(); + List elements = new ArrayList<>(); elements.add(nvGen); return new AnnotationGen(t, elements, visibility, cp); } diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java index b826fc7a0..45fd47c7b 100644 --- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java +++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java @@ -523,7 +523,7 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { ObjectType t = new ObjectType("SimpleAnnotation"); - List elements = new ArrayList(); + List elements = new ArrayList<>(); elements.add(nvGen); AnnotationGen a = new AnnotationGen(t, elements, true, cp); @@ -534,7 +534,7 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { SimpleElementValue evg = new SimpleElementValue(ElementValue.STRING, cp, aFruit); NameValuePair nvGen = new NameValuePair("fruit", evg, cp); ObjectType t = new ObjectType("SimpleStringAnnotation"); - List elements = new ArrayList(); + List elements = new ArrayList<>(); elements.add(nvGen); return new AnnotationGen(t, elements, true, cp); } @@ -545,7 +545,7 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { ArrayElementValue array = new ArrayElementValue(cp); array.addElement(new AnnotationElementValue(a, cp)); NameValuePair nvp = new NameValuePair("value", array, cp); - List elements = new ArrayList(); + List elements = new ArrayList<>(); elements.add(nvp); return new AnnotationGen(new ObjectType("CombinedAnnotation"), elements, true, cp); } @@ -557,7 +557,7 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { ObjectType t = new ObjectType("SimpleAnnotation"); - List elements = new ArrayList(); + List elements = new ArrayList<>(); elements.add(nvGen); AnnotationGen a = new AnnotationGen(t, elements, false, cp); diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java index b15e5f325..255dc77ff 100644 --- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java +++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java @@ -415,7 +415,7 @@ public class GenericSignatureParsingTest extends BcelTestCase { * @return Array of argument types */ public static final String[] methodSignatureArgumentTypes(String signature,boolean chopit) throws ClassFormatException { - ArrayList vec = new ArrayList(); + ArrayList vec = new ArrayList<>(); int index; String[] types; diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/NonCachingClassLoaderRepositoryTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/NonCachingClassLoaderRepositoryTest.java index c8eda5d40..e9fd78561 100644 --- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/NonCachingClassLoaderRepositoryTest.java +++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/NonCachingClassLoaderRepositoryTest.java @@ -121,7 +121,7 @@ public class NonCachingClassLoaderRepositoryTest extends TestCase { } public void testConcurrency() throws ClassNotFoundException, InterruptedException { - List loaders = new ArrayList(); + List loaders = new ArrayList<>(); int i1 = 1000; for (int i = 0; i < i1; i++) { DoneChecker loader = new Loader(); diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java index 351caa002..8a979b73f 100644 --- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java +++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java @@ -551,7 +551,7 @@ public class ParameterAnnotationsTest extends BcelTestCase { ObjectType t = new ObjectType("SimpleAnnotation"); - List elements = new ArrayList(); + List elements = new ArrayList<>(); elements.add(nvGen); AnnotationGen a = new AnnotationGen(t, elements,true, cp); @@ -564,7 +564,7 @@ public class ParameterAnnotationsTest extends BcelTestCase { ArrayElementValue array = new ArrayElementValue(cp); array.addElement(new AnnotationElementValue(a,cp)); NameValuePair nvp = new NameValuePair("value",array,cp); - List elements = new ArrayList(); + List elements = new ArrayList<>(); elements.add(nvp); return new AnnotationGen(new ObjectType("CombinedAnnotation"),elements,true,cp); } @@ -577,7 +577,7 @@ public class ParameterAnnotationsTest extends BcelTestCase { ObjectType t = new ObjectType("SimpleAnnotation"); - List elements = new ArrayList(); + List elements = new ArrayList<>(); elements.add(nvGen); AnnotationGen a = new AnnotationGen(t, elements,false, cp); diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java index af3df5c6a..a4926caa5 100644 --- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java +++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java @@ -383,7 +383,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase { public static List getListOfAnnotationNames(AnnotationGen a) { List l = a.getValues(); - List names = new ArrayList(); + List names = new ArrayList<>(); for (NameValuePair element : l) { names.add(element.getNameString()); } diff --git a/bridge/src/main/java/org/aspectj/bridge/AbortException.java b/bridge/src/main/java/org/aspectj/bridge/AbortException.java index acde7cd28..6dac2005e 100644 --- a/bridge/src/main/java/org/aspectj/bridge/AbortException.java +++ b/bridge/src/main/java/org/aspectj/bridge/AbortException.java @@ -45,7 +45,7 @@ public class AbortException extends RuntimeException { // XXX move porters out, /** used when message text is null */ public static final String NO_MESSAGE_TEXT = "AbortException (no message)"; - private static final ArrayList porters = new ArrayList(); + private static final ArrayList porters = new ArrayList<>(); /** * Get a porter exception from the pool. Porter exceptions do not have valid stack traces. They are used only to avoid diff --git a/bridge/src/main/java/org/aspectj/bridge/CountingMessageHandler.java b/bridge/src/main/java/org/aspectj/bridge/CountingMessageHandler.java index 4ce550876..1a1e8f014 100644 --- a/bridge/src/main/java/org/aspectj/bridge/CountingMessageHandler.java +++ b/bridge/src/main/java/org/aspectj/bridge/CountingMessageHandler.java @@ -38,7 +38,7 @@ public class CountingMessageHandler implements IMessageHandler { public CountingMessageHandler(IMessageHandler delegate) { LangUtil.throwIaxIfNull(delegate, "delegate"); this.delegate = delegate; - this.counters = new Hashtable(); + this.counters = new Hashtable<>(); proxy = (delegate instanceof CountingMessageHandler ? (CountingMessageHandler) delegate : null); } diff --git a/bridge/src/main/java/org/aspectj/bridge/MessageHandler.java b/bridge/src/main/java/org/aspectj/bridge/MessageHandler.java index 6fd8539cc..23c2ef3b2 100644 --- a/bridge/src/main/java/org/aspectj/bridge/MessageHandler.java +++ b/bridge/src/main/java/org/aspectj/bridge/MessageHandler.java @@ -48,8 +48,8 @@ public class MessageHandler implements IMessageHolder { * @param accumulateOnly the result of handleMessage (i.e., if true, then only accumulate messages - stop processing */ public MessageHandler(boolean accumulateOnly) { - messages = new ArrayList(); - ignoring = new ArrayList(); + messages = new ArrayList<>(); + ignoring = new ArrayList<>(); init(accumulateOnly); ignore(IMessage.WEAVEINFO); // Off by default, need to explicitly be enabled (see -showWeaveInfo) } @@ -207,7 +207,7 @@ public class MessageHandler implements IMessageHolder { if (null == kind) { return messages.toArray(IMessage.RA_IMessage); } - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); if (!orGreater) { for (IMessage m : messages) { if (kind == m.getKind()) { diff --git a/bridge/src/main/java/org/aspectj/bridge/MessageUtil.java b/bridge/src/main/java/org/aspectj/bridge/MessageUtil.java index 77f9c90a8..d55ac3c3b 100644 --- a/bridge/src/main/java/org/aspectj/bridge/MessageUtil.java +++ b/bridge/src/main/java/org/aspectj/bridge/MessageUtil.java @@ -409,7 +409,7 @@ public class MessageUtil { if (null == kind) { return messages; } - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); for (IMessage message : messages) { if (kind == message.getKind()) { result.add(message); @@ -478,7 +478,7 @@ public class MessageUtil { return IMessage.RA_IMessage; } LangUtil.throwIaxIfNull(visitor, "visitor"); - ArrayList result = (accumulate ? new ArrayList() : null); + ArrayList result = (accumulate ? new ArrayList<>() : null); for (IMessage m : messages) { if (visitor.handleMessage(m)) { if (accumulate) { diff --git a/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java b/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java index 6117b96a9..2ae13a279 100644 --- a/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java +++ b/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java @@ -87,13 +87,13 @@ public class CompilationAndWeavingContext { "type munging for @AspectJ aspectOf" }; // context stacks, one per thread - private static ThreadLocal> contextMap = new ThreadLocal>(); + private static ThreadLocal> contextMap = new ThreadLocal<>(); // single thread mode stack - private static Stack contextStack = new Stack(); + private static Stack contextStack = new Stack<>(); // formatters, by phase id - private static Map formatterMap = new HashMap(); + private static Map formatterMap = new HashMap<>(); private static ContextFormatter defaultFormatter = new DefaultFormatter(); @@ -131,7 +131,7 @@ public class CompilationAndWeavingContext { */ public static String getCurrentContext() { Stack contextStack = getContextStack(); - Stack explanationStack = new Stack(); + Stack explanationStack = new Stack<>(); for (ContextStackEntry entry : contextStack) { Object data = entry.getData(); if (data != null) { @@ -150,7 +150,7 @@ public class CompilationAndWeavingContext { public static ContextToken enteringPhase(int phaseId, Object data) { Stack contextStack = getContextStack(); ContextTokenImpl nextToken = nextToken(); - contextStack.push(new ContextStackEntry(nextToken, phaseId, new WeakReference(data))); + contextStack.push(new ContextStackEntry(nextToken, phaseId, new WeakReference<>(data))); return nextToken; } @@ -183,7 +183,7 @@ public class CompilationAndWeavingContext { } else { Stack contextStack = contextMap.get(); if (contextStack == null) { - contextStack = new Stack(); + contextStack = new Stack<>(); contextMap.set(contextStack); } return contextStack; diff --git a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java index 12286748e..91506e439 100644 --- a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java +++ b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java @@ -409,7 +409,7 @@ public class AntBuilder extends Builder { */ @Override protected Result[] getAntecedantResults(Result moduleResult) { - Hashtable targets = new Hashtable(); + Hashtable targets = new Hashtable<>(); makeTargetsForResult(moduleResult, targets); String targetName = resultToTargetName(moduleResult); // bug: doc says topoSort returns String, but returns Target @@ -419,7 +419,7 @@ public class AntBuilder extends Builder { if (0 == result.size()) { return new Result[0]; } - ArrayList toReturn = new ArrayList(); + ArrayList toReturn = new ArrayList<>(); for (Target target : result) { String name = target.getName(); if (null == name) { diff --git a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java index aa0c35e35..ed64e74e0 100644 --- a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java +++ b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java @@ -83,7 +83,7 @@ public class Checklics extends MatchingTask { License MPL_ONLY = new License(MPL_ONLY_TAG, LIC_MPL); License MPL_PARC = new License(MPL_PARC_TAG, LIC_MPL, PARC); License PARC_COPYRIGHT = new License(PARC_COPYRIGHT_TAG, null, PARC); - LICENSES = new Hashtable(); + LICENSES = new Hashtable<>(); LICENSES.put(APL.tag, APL); LICENSES.put(MPL.tag, MPL); LICENSES.put(MPL_PARC.tag, MPL_PARC); @@ -469,7 +469,7 @@ class HeaderInfo { this.lastLine = lastLine; this.file = file; this.hasLicense = hasLicense; - List newYears = new ArrayList(); + List newYears = new ArrayList<>(); newYears.addAll(years); Collections.sort(newYears); this.years = Collections.unmodifiableList(newYears); @@ -618,7 +618,7 @@ class Header { } public static HeaderInfo checkFile(final File file) { - ArrayList years = new ArrayList(); + ArrayList years = new ArrayList<>(); int endLine = 0; BufferedReader input = null; int lineNum = 0; diff --git a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java index e71795912..431f9b25b 100644 --- a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java +++ b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java @@ -28,7 +28,7 @@ public abstract class ConditionalTask extends Task { private List ifs; protected List ifs() { - return ifs != null ? ifs : (ifs = new Vector()); + return ifs != null ? ifs : (ifs = new Vector<>()); } public If createIf() { @@ -169,7 +169,7 @@ public abstract class ConditionalTask extends Task { protected List getFalses() { Iterator iter = ifs().iterator(); - List result = new Vector(); + List result = new Vector<>(); while (iter.hasNext()) { If next = iter.next(); String name = next.getName(); diff --git a/build/src/main/java/org/aspectj/internal/tools/build/Builder.java b/build/src/main/java/org/aspectj/internal/tools/build/Builder.java index fe80190ad..ac13870c8 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/Builder.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/Builder.java @@ -149,7 +149,7 @@ public abstract class Builder { if ((null == text) || (0 == text.length())) { return Collections.EMPTY_LIST; } - List strings = new ArrayList(); + List strings = new ArrayList<>(); StringTokenizer tok = new StringTokenizer(text, ","); while (tok.hasMoreTokens()) { String token = tok.nextToken().trim(); @@ -275,7 +275,7 @@ public abstract class Builder { return buildProduct(buildSpec); } Result result = specifyResultFor(buildSpec); - ArrayList errors = new ArrayList(); + ArrayList errors = new ArrayList<>(); try { return buildAll(result, errors); } finally { @@ -340,7 +340,7 @@ public abstract class Builder { */ protected final boolean buildAll(Result result, List errors) { Result[] buildList = skipUptodate(getAntecedantResults(result)); - ArrayList doneList = new ArrayList(); + ArrayList doneList = new ArrayList<>(); if ((null != buildList) && (0 < buildList.length)) { if (isLogging()) { handler.log("modules to build: " + Arrays.asList(buildList)); @@ -543,7 +543,7 @@ public abstract class Builder { * deliverables. */ protected ProductModule[] discoverModules(File productDir, Modules modules) { - final ArrayList found = new ArrayList(); + final ArrayList found = new ArrayList<>(); FileFilter filter = new FileFilter() {// empty jar files public boolean accept(File file) { if ((null != file) && file.canRead() @@ -555,7 +555,7 @@ public abstract class Builder { } }; Util.visitFiles(productDir, filter); - ArrayList results = new ArrayList(); + ArrayList results = new ArrayList<>(); for (File file: found) { String jarName = moduleAliasFor(file.getName().toLowerCase()); if (jarName.endsWith(".jar") || jarName.endsWith(".zip")) { // XXXFileLiteral diff --git a/build/src/main/java/org/aspectj/internal/tools/build/Module.java b/build/src/main/java/org/aspectj/internal/tools/build/Module.java index 65d929707..3f34b3f5e 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/Module.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/Module.java @@ -69,7 +69,7 @@ public class Module { /** @return all source files under srcDir */ private static Iterator sourceFiles(File srcDir) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); sourceFiles(srcDir, result); return result.iterator(); } @@ -198,11 +198,11 @@ public class Module { Util.iaxIfNull(name, "name"); Util.iaxIfNull(modules, "modules"); this.moduleDir = moduleDir; - this.libJars = new ArrayList(); - this.exportedLibJars = new ArrayList(); - this.requiredModules = new ArrayList(); - this.srcDirs = new ArrayList(); - this.classpathVariables = new ArrayList(); + this.libJars = new ArrayList<>(); + this.exportedLibJars = new ArrayList<>(); + this.requiredModules = new ArrayList<>(); + this.srcDirs = new ArrayList<>(); + this.classpathVariables = new ArrayList<>(); this.properties = new Properties(); this.name = name; this.modules = modules; @@ -609,7 +609,7 @@ public class Module { String[] tokenize(String line) { final String DELIM = " \n\t\\<>\"="; StringTokenizer st = new StringTokenizer(line, DELIM, true); - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); StringBuffer quote = new StringBuffer(); boolean inQuote = false; while (st.hasMoreTokens()) { diff --git a/build/src/main/java/org/aspectj/internal/tools/build/Modules.java b/build/src/main/java/org/aspectj/internal/tools/build/Modules.java index 83686820e..ca2b50aac 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/Modules.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/Modules.java @@ -24,7 +24,7 @@ import java.util.Hashtable; */ public class Modules { - private final Hashtable modules = new Hashtable(); + private final Hashtable modules = new Hashtable<>(); public final File baseDir; public final File jarDir; private final Messager handler; diff --git a/build/src/main/java/org/aspectj/internal/tools/build/Result.java b/build/src/main/java/org/aspectj/internal/tools/build/Result.java index b17ac656e..563a6932e 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/Result.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/Result.java @@ -38,7 +38,7 @@ public class Result { private static final Kind[] KINDS = { RELEASE, TEST, RELEASE_ALL, TEST_ALL }; - private static final HashMap nameToResult = new HashMap(); + private static final HashMap nameToResult = new HashMap<>(); public static boolean isTestingJar(String name) { name = name.toLowerCase(); @@ -177,11 +177,11 @@ public class Result { Result(Kind kind, Module module, File jarDir) { this.kind = kind; this.module = module; - this.libJars = new ArrayList(); - this.exportedLibJars = new ArrayList(); - this.srcDirs = new ArrayList(); - this.classpathVariables = new ArrayList(); - this.requiredResults = new ArrayList(); + this.libJars = new ArrayList<>(); + this.exportedLibJars = new ArrayList<>(); + this.srcDirs = new ArrayList<>(); + this.classpathVariables = new ArrayList<>(); + this.requiredResults = new ArrayList<>(); String name = module.name; if (!kind.normal) { name += "-test"; @@ -217,7 +217,7 @@ public class Result { /** @return List (File) of jar's required */ public List findJarRequirements() { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); Module.doFindJarRequirements(this, result); return result; } diff --git a/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java b/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java index 4df90dbbe..ca041b33d 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java @@ -404,7 +404,7 @@ class Sample { * type-safe Collection of samples. */ class Samples { - private ArrayList samples = new ArrayList(); + private ArrayList samples = new ArrayList<>(); int size() { return samples.size(); } @@ -419,7 +419,7 @@ class Samples { } List getSortedSamples(Comparator comparer) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); result.addAll(samples); Collections.sort(result, comparer); return result; @@ -966,7 +966,7 @@ class SampleUtil { } public static String[] splitAnchorName(String anchorName) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); int start = 0; int loc = anchorName.indexOf("-", start); String next; diff --git a/build/src/test/java/org/aspectj/build/BuildModuleTests.java b/build/src/test/java/org/aspectj/build/BuildModuleTests.java index 042548d3f..f4aaa5708 100644 --- a/build/src/test/java/org/aspectj/build/BuildModuleTests.java +++ b/build/src/test/java/org/aspectj/build/BuildModuleTests.java @@ -69,7 +69,7 @@ public class BuildModuleTests extends TestCase { * @return */ private static File[] findSourceRoots(File moduleDir) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); for (String name: SOURCE_NAMES) { File srcDir = new File(moduleDir, name); if (srcDir.canRead() && srcDir.isDirectory()) { @@ -198,7 +198,7 @@ public class BuildModuleTests extends TestCase { // separate check to verify all file types (suffixes) are known if (!isTestFolder(srcDir)) { - ArrayList unknownFiles = new ArrayList(); + ArrayList unknownFiles = new ArrayList<>(); UnknownFileCheck.SINGLETON.unknownFiles(srcDir, unknownFiles); System.out.println(unknownFiles); if (!unknownFiles.isEmpty()) { @@ -225,12 +225,12 @@ public class BuildModuleTests extends TestCase { */ static class UnknownFileCheck implements FileFilter { private static final UnknownFileCheck SINGLETON = new UnknownFileCheck(); - private static final ArrayList STATIC_ERRORS = new ArrayList(); + private static final ArrayList STATIC_ERRORS = new ArrayList<>(); // Builder.BINARY_SOURCE_PATTERN and Builder.RESOURCE_PATTERN public static final List KNOWN_SUFFIXES; static { - List suffixes = new ArrayList(); + List suffixes = new ArrayList<>(); // sources from org.aspectj.util.FileUtil.SOURCE_SUFFIXES suffixes.add(".aj"); suffixes.add(".java"); diff --git a/build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java b/build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java index 81600ca94..7693ddb11 100644 --- a/build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java +++ b/build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java @@ -80,7 +80,7 @@ public class BuildModuleTest extends TestCase { } } - ArrayList tempFiles = new ArrayList(); + ArrayList tempFiles = new ArrayList<>(); private File jarDir; private boolean deleteJars; boolean building; // must be enabled for tests to run @@ -343,7 +343,7 @@ public class BuildModuleTest extends TestCase { try { zipFile = new ZipFile(weaverAllJar); Enumeration e = zipFile.entries(); - ArrayList entryNames = new ArrayList(); + ArrayList entryNames = new ArrayList<>(); while (e.hasMoreElements()) { ZipEntry entry = (ZipEntry) e.nextElement(); String name = entry.getName(); diff --git a/build/src/test/java/org/aspectj/internal/build/ModulesTest.java b/build/src/test/java/org/aspectj/internal/build/ModulesTest.java index 383b3859d..494084e0c 100644 --- a/build/src/test/java/org/aspectj/internal/build/ModulesTest.java +++ b/build/src/test/java/org/aspectj/internal/build/ModulesTest.java @@ -72,7 +72,7 @@ public class ModulesTest extends TestCase { } } - ArrayList tempFiles = new ArrayList(); + ArrayList tempFiles = new ArrayList<>(); public ModulesTest(String name) { super(name); @@ -101,7 +101,7 @@ public class ModulesTest extends TestCase { } public void testAllModulesCreation() { - ArrayList badModules = new ArrayList(); + ArrayList badModules = new ArrayList<>(); for (String name: MODULE_NAMES) { File dir = new File(BASE_DIR, name); if (dir.isDirectory()) { diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java index abd8ecc87..57db3092f 100644 --- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java +++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java @@ -265,7 +265,7 @@ public class Aj implements ClassPreProcessor { if (loadersToSkipProperty != null && loadersToSkip == null) { if (st.hasMoreTokens()) { // System.out.println("aj.weaving.loadersToSkip is set. Skipping loaders: '"+loadersToSkipProperty+"'"); - loadersToSkip = new ArrayList(); + loadersToSkip = new ArrayList<>(); } while (st.hasMoreTokens()) { String nextLoader = st.nextToken(); @@ -283,7 +283,7 @@ public class Aj implements ClassPreProcessor { static class WeaverContainer { final static Map weavingAdaptors = - Collections.synchronizedMap(new HashMap()); + Collections.synchronizedMap(new HashMap<>()); static WeavingAdaptor getWeaver(ClassLoader loader, IWeavingContext weavingContext) { ExplicitlyInitializedClassLoaderWeavingAdaptor adaptor = null; diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 5827f2e64..0edd55721 100644 --- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -69,33 +69,33 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { private boolean initialized; - private List dumpTypePattern = new ArrayList(); + private List dumpTypePattern = new ArrayList<>(); private boolean dumpBefore = false; private boolean dumpDirPerClassloader = false; private boolean hasExcludes = false; - private List excludeTypePattern = new ArrayList(); // anything - private List excludeStartsWith = new ArrayList(); // com.foo..* - private List excludeStarDotDotStar = new ArrayList(); // *..*CGLIB* - private List excludeExactName = new ArrayList(); // com.foo.Bar - private List excludeEndsWith = new ArrayList(); // com.foo.Bar - private List excludeSpecial = new ArrayList(); + private List excludeTypePattern = new ArrayList<>(); // anything + private List excludeStartsWith = new ArrayList<>(); // com.foo..* + private List excludeStarDotDotStar = new ArrayList<>(); // *..*CGLIB* + private List excludeExactName = new ArrayList<>(); // com.foo.Bar + private List excludeEndsWith = new ArrayList<>(); // com.foo.Bar + private List excludeSpecial = new ArrayList<>(); private boolean hasIncludes = false; - private List includeTypePattern = new ArrayList(); - private List includeStartsWith = new ArrayList(); - private List includeExactName = new ArrayList(); + private List includeTypePattern = new ArrayList<>(); + private List includeStartsWith = new ArrayList<>(); + private List includeExactName = new ArrayList<>(); private boolean includeStar = false; - private List aspectExcludeTypePattern = new ArrayList(); - private List aspectExcludeStartsWith = new ArrayList(); - private List aspectIncludeTypePattern = new ArrayList(); - private List aspectIncludeStartsWith = new ArrayList(); + private List aspectExcludeTypePattern = new ArrayList<>(); + private List aspectExcludeStartsWith = new ArrayList<>(); + private List aspectIncludeTypePattern = new ArrayList<>(); + private List aspectIncludeStartsWith = new ArrayList<>(); private StringBuffer namespace; private IWeavingContext weavingContext; - private List concreteAspects = new ArrayList(); + private List concreteAspects = new ArrayList<>(); private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassLoaderWeavingAdaptor.class); @@ -218,7 +218,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { * @return */ List getAspectClassNames(List definitions) { - List aspects = new LinkedList(); + List aspects = new LinkedList<>(); for (Definition def : definitions) { List defAspects = def.getAspectClassNames(); if (defAspects != null) { @@ -238,7 +238,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { trace.enter("parseDefinitions", this); } - List definitions = new ArrayList(); + List definitions = new ArrayList<>(); try { info("register classloader " + getClassLoaderName(loader)); // TODO av underoptimized: we will parse each XML once per CL that see it @@ -277,7 +277,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { Enumeration xmls = weavingContext.getResources(nextDefinition); // System.out.println("? registerDefinitions: found-aop.xml=" + xmls.hasMoreElements() + ", loader=" + loader); - Set seenBefore = new HashSet(); + Set seenBefore = new HashSet<>(); while (xmls.hasMoreElements()) { URL xml = xmls.nextElement(); if (trace.isTraceEnabled()) { @@ -1002,7 +1002,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { */ public void flushGeneratedClasses() { // System.err.println("? ClassLoaderWeavingAdaptor.flushGeneratedClasses() generatedClasses=" + generatedClasses); - generatedClasses = new HashMap(); + generatedClasses = new HashMap<>(); } /** diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java index 7f87e40c9..fcc89ac75 100644 --- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java +++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java @@ -218,7 +218,7 @@ public class ConcreteAspectCodeGen { } // must have all abstractions defined - List elligibleAbstractions = new ArrayList(); + List elligibleAbstractions = new ArrayList<>(); Collection abstractMethods = getOutstandingAbstractMethods(parent); for (ResolvedMember method : abstractMethods) { @@ -254,7 +254,7 @@ public class ConcreteAspectCodeGen { } } } - List pointcutNames = new ArrayList(); + List pointcutNames = new ArrayList<>(); for (Definition.Pointcut abstractPc : concreteAspect.pointcuts) { pointcutNames.add(abstractPc.name); } @@ -283,7 +283,7 @@ public class ConcreteAspectCodeGen { } private Collection getOutstandingAbstractMethods(ResolvedType type) { - Map collector = new HashMap(); + Map collector = new HashMap<>(); // let's get to the top of the hierarchy and then walk down ... // recording abstract methods then removing // them if they get defined further down the hierarchy @@ -411,7 +411,7 @@ public class ConcreteAspectCodeGen { cg.addAnnotation(ag); } else { // List elems = new ArrayList(); - List elems = new ArrayList(); + List elems = new ArrayList<>(); elems.add(new NameValuePair("value", new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), perclauseString), cg.getConstantPool())); AnnotationGen ag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/Aspect"), elems, true, @@ -420,7 +420,7 @@ public class ConcreteAspectCodeGen { } if (concreteAspect.precedence != null) { SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), concreteAspect.precedence); - List elems = new ArrayList(); + List elems = new ArrayList<>(); elems.add(new NameValuePair("value", svg, cg.getConstantPool())); AnnotationGen agprec = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/DeclarePrecedence"), elems, true, cg.getConstantPool()); @@ -440,7 +440,7 @@ public class ConcreteAspectCodeGen { // TODO AV - respect visibility instead of opening up as public? LazyMethodGen mg = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, abstractPc.name, EMPTY_TYPES, EMPTY_STRINGS, cg); SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), abstractPc.expression); - List elems = new ArrayList(); + List elems = new ArrayList<>(); elems.add(new NameValuePair("value", svg, cg.getConstantPool())); AnnotationGen mag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/Pointcut"), elems, true, cg.getConstantPool()); @@ -462,7 +462,7 @@ public class ConcreteAspectCodeGen { FieldGen field = new FieldGen(Modifier.FINAL, ObjectType.STRING, "rule" + (counter++), cg.getConstantPool()); SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), deow.pointcut); - List elems = new ArrayList(); + List elems = new ArrayList<>(); elems.add(new NameValuePair("value", svg, cg.getConstantPool())); AnnotationGen mag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/Declare" + (deow.isError ? "Error" : "Warning")), elems, true, cg.getConstantPool()); @@ -601,7 +601,7 @@ public class ConcreteAspectCodeGen { // Discover the name and name/value pairs String name = annotationString.substring(0,paren); // break the rest into pieces based on the commas - List values = new ArrayList(); + List values = new ArrayList<>(); int pos = paren+1; int depth = 0; int len = annotationString.length(); @@ -776,7 +776,7 @@ public class ConcreteAspectCodeGen { reportError("declare is using an annotation type that does not have runtime retention: "+typename); return null; } - List elems = new ArrayList(); + List elems = new ArrayList<>(); return new AnnotationGen(new ObjectType(annoname), elems, true, cp); } @@ -820,8 +820,8 @@ public class ConcreteAspectCodeGen { } // Extract parameter types and names - List paramTypes = new ArrayList(); - List paramNames = new ArrayList(); + List paramTypes = new ArrayList<>(); + List paramNames = new ArrayList<>(); if (signature.charAt(1) != ')') { // there are parameters to convert into a signature StringBuilder convertedSignature = new StringBuilder("("); @@ -968,7 +968,7 @@ public class ConcreteAspectCodeGen { */ private AnnotationAJ buildAdviceAnnotation(LazyClassGen cg, PointcutAndAdvice paa) { SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), paa.pointcut); - List elems = new ArrayList(); + List elems = new ArrayList<>(); elems.add(new NameValuePair("value", svg, cg.getConstantPool())); AnnotationGen mag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/" + paa.adviceKind.toString()), elems, true, cg.getConstantPool()); diff --git a/loadtime/src/test/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java b/loadtime/src/test/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java index 3b2ee51e3..77603e12c 100644 --- a/loadtime/src/test/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java +++ b/loadtime/src/test/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java @@ -686,7 +686,7 @@ public class ClassLoaderWeavingAdaptorTest extends TestCase { static class TestWeavingContext extends DefaultWeavingContext { - List testList = new ArrayList(); + List testList = new ArrayList<>(); public TestWeavingContext(ClassLoader loader) { super(loader); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java index 57af301f2..07332990f 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java @@ -152,10 +152,10 @@ public class BuildArgParser extends Main { boolean incrementalMode = buildConfig.isIncrementalMode() || buildConfig.isIncrementalFileMode(); - List xmlfileList = new ArrayList(); + List xmlfileList = new ArrayList<>(); xmlfileList.addAll(parser.getXmlFiles()); - List fileList = new ArrayList(); + List fileList = new ArrayList<>(); List files = parser.getFiles(); if (!LangUtil.isEmpty(files)) { if (incrementalMode) { @@ -165,7 +165,7 @@ public class BuildArgParser extends Main { } } - List javaArgList = new ArrayList(); + List javaArgList = new ArrayList<>(); // disable all special eclipse warnings by default - why??? // ??? might want to instead override getDefaultOptions() javaArgList.add("-warn:none"); @@ -280,7 +280,7 @@ public class BuildArgParser extends Main { } private ArrayList toArrayList(java.util.List files) { - ArrayList arrayList = new ArrayList(); + ArrayList arrayList = new ArrayList<>(); for (File file: files) { arrayList.add(file.getAbsolutePath()); } @@ -363,7 +363,7 @@ public class BuildArgParser extends Main { } public List getBootclasspath(AjcConfigParser parser) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); if (parser.bootclasspath == null) { if (LangUtil.is19VMOrGreater()) { @@ -378,13 +378,13 @@ public class BuildArgParser extends Main { } public List getModulepath(AjcConfigParser parser) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); addClasspath(parser.modulepath, ret); return ret; } public List getModulesourcepath(AjcConfigParser parser) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); addClasspath(parser.modulesourcepath, ret); return ret; } @@ -565,7 +565,7 @@ public class BuildArgParser extends Main { buildConfig.setMakeReflectable(true); } else if (arg.equals("-sourceroots")) { if (args.size() > nextArgIndex) { - List sourceRoots = new ArrayList(); + List sourceRoots = new ArrayList<>(); StringTokenizer st = new StringTokenizer(args.get(nextArgIndex).getValue(), File.pathSeparator); while (st.hasMoreTokens()) { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/ConfigParser.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/ConfigParser.java index bdb87cb2b..f290d910a 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/ConfigParser.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/ConfigParser.java @@ -26,8 +26,8 @@ import java.util.StringTokenizer; public class ConfigParser { Location location; protected File relativeDirectory = null; - protected List files = new LinkedList(); - protected List xmlfiles = new ArrayList(); + protected List files = new LinkedList<>(); + protected List xmlfiles = new ArrayList<>(); private boolean fileParsed = false; protected static String CONFIG_MSG = "build config error: "; @@ -41,7 +41,7 @@ public class ConfigParser { public void parseCommandLine(String[] argsArray) throws ParseException { location = new CommandLineLocation(); - LinkedList args = new LinkedList(); + LinkedList args = new LinkedList<>(); for (String s : argsArray) { args.add(new Arg(s, location)); } @@ -80,7 +80,7 @@ public class ConfigParser { return; } - LinkedList args = new LinkedList(); + LinkedList args = new LinkedList<>(); int lineNum = 0; try { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java index 6ea878265..5c2e4d2c7 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java @@ -108,7 +108,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { private IOutputClassFileNameProvider outputFileNameProvider; private IBinarySourceProvider binarySourceProvider; private WeaverMessageHandler weaverMessageHandler; - private Map> binarySourceSetForFullWeave = new HashMap>(); + private Map> binarySourceSetForFullWeave = new HashMap<>(); private ContextToken processingToken = null; private ContextToken resolvingToken = null; @@ -118,7 +118,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { private AjState incrementalCompilationState; // Maintains a list of whats weaving - whilst the pipeline is stalled, this accumulates aspects. - List resultsPendingWeave = new ArrayList(); + List resultsPendingWeave = new ArrayList<>(); // pipelining info private boolean pipelineStalled = true; @@ -200,8 +200,8 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { } // Break the units into two lists... - List aspects = new ArrayList(); - List nonaspects = new ArrayList(); + List aspects = new ArrayList<>(); + List nonaspects = new ArrayList<>(); for (CompilationUnitDeclaration unit : units) { if (containsAnAspect(unit)) { aspects.add(unit); @@ -255,7 +255,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { } public void beforeCompiling(ICompilationUnit[] sourceUnits) { - resultsPendingWeave = new ArrayList(); + resultsPendingWeave = new ArrayList<>(); reportedErrors = false; droppingBackToFullBuild = false; } @@ -475,7 +475,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { private List getBinarySourcesFrom(Map> binarySourceEntries) { // Map is fileName |-> List - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (String sourceFileName : binarySourceEntries.keySet()) { List unwovenClassFiles = binarySourceEntries.get(sourceFileName); // XXX - see bugs 57432,58679 - final parameter on next call should be "compiler.options.maxProblemsPerUnit" diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java index eb5ca53d9..364aea401 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java @@ -209,7 +209,7 @@ public class WeaverMessageHandler implements IMessageHandler { private IProblem[] buildSeeAlsoProblems(IProblem originalProblem, List sourceLocations, CompilationResult problemSource, boolean usedBinarySourceFileName) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (Object sourceLocation : sourceLocations) { ISourceLocation loc = (ISourceLocation) sourceLocation; diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java index 5bf9946da..68fc6f74f 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java @@ -66,7 +66,7 @@ public class AccessForInlineVisitor extends ASTVisitor { PrivilegedHandler handler; AspectDeclaration inAspect; EclipseFactory world; // alias for inAspect.world - private Map> alreadyProcessedReceivers = new HashMap>(); + private Map> alreadyProcessedReceivers = new HashMap<>(); // set to true for ClassLiteralAccess and AssertStatement // ??? A better answer would be to transform these into inlinable forms @@ -174,7 +174,7 @@ public class AccessForInlineVisitor extends ASTVisitor { // Avoid repeatedly building ResolvedMembers by using info on any done previously in this visitor Map alreadyResolvedMembers = alreadyProcessedReceivers.get(receiverType); if (alreadyResolvedMembers == null) { - alreadyResolvedMembers = new HashMap(); + alreadyResolvedMembers = new HashMap<>(); alreadyProcessedReceivers.put(receiverType, alreadyResolvedMembers); } ResolvedMember m = alreadyResolvedMembers.get(binding); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java index 91d998692..675f0656f 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java @@ -65,7 +65,7 @@ public class AdviceDeclaration extends AjMethodDeclaration { public int adviceSequenceNumberInType; public MethodBinding proceedMethodBinding; // set during this.resolveStaments, referenced by Proceed - public List proceedCalls = new ArrayList(2); // populated during Proceed.findEnclosingAround + public List proceedCalls = new ArrayList<>(2); // populated during Proceed.findEnclosingAround private boolean proceedInInners; private ResolvedMember[] proceedCallSignatures; @@ -80,7 +80,7 @@ public class AdviceDeclaration extends AjMethodDeclaration { // override protected int generateInfoAttributes(ClassFile classFile) { - List l = new ArrayList(1); + List l = new ArrayList<>(1); l.add(new EclipseAttributeAdapter(makeAttribute())); addDeclarationStartLineAttribute(l, classFile); return classFile.generateMethodInfoAttributes(binding, l); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java index 78cca38c0..777de27e4 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java @@ -84,8 +84,8 @@ public class AspectDeclaration extends TypeDeclaration { public ResolvedMember aspectOfMethod; public ResolvedMember ptwGetWithinTypeNameMethod; public ResolvedMember hasAspectMethod; - public Map accessForInline = new LinkedHashMap(); - public Map superAccessForInline = new HashMap(); + public Map accessForInline = new LinkedHashMap<>(); + public Map superAccessForInline = new HashMap<>(); public boolean isPrivileged; public EclipseSourceType concreteName; public ReferenceType typeX; @@ -418,7 +418,7 @@ public class AspectDeclaration extends TypeDeclaration { } protected List makeEffectiveSignatureAttribute(ResolvedMember sig, Shadow.Kind kind, boolean weaveBody) { - List l = new ArrayList(1); + List l = new ArrayList<>(1); l.add(new EclipseAttributeAdapter(new AjAttribute.EffectiveSignatureAttribute(sig, kind, weaveBody))); return l; } diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index 0384617f9..d79755dde 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -93,7 +93,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC public EclipseFactory factory = null; // private boolean builtInterTypesAndPerClauses = false; - private final List pendingTypesToWeave = new ArrayList(); + private final List pendingTypesToWeave = new ArrayList<>(); // Q: What are dangerousInterfaces? // A: An interface is considered dangerous if an ITD has been made upon it @@ -190,8 +190,8 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // need to build inter-type declarations for all AspectDeclarations at // this point // this MUST be done in order from super-types to subtypes - List typesToProcess = new ArrayList(); - List aspectsToProcess = new ArrayList(); + List typesToProcess = new ArrayList<>(); + List aspectsToProcess = new ArrayList<>(); for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { CompilationUnitScope cus = units[i].scope; SourceTypeBinding[] stbs = cus.topLevelTypes; @@ -250,7 +250,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC boolean typeProcessingOrderIsImportant = declareParents.size() > 0 || declareAnnotationOnTypes.size() > 0; // DECAT if (typeProcessingOrderIsImportant) { - typesToProcess = new ArrayList(); + typesToProcess = new ArrayList<>(); for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { CompilationUnitScope cus = units[i].scope; SourceTypeBinding[] stbs = cus.topLevelTypes; @@ -259,7 +259,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC } } - List stb2 = new ArrayList(); + List stb2 = new ArrayList<>(); stb2.addAll(typesToProcess); while (typesToProcess.size() > 0) { @@ -730,8 +730,8 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // not-exposed to weaver // messages... - List decpToRepeat = new ArrayList(); - List decaToRepeat = new ArrayList(); + List decpToRepeat = new ArrayList<>(); + List decaToRepeat = new ArrayList<>(); boolean anyNewParents = false; boolean anyNewAnnotations = false; @@ -768,7 +768,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC } } - List forRemoval = new ArrayList(); + List forRemoval = new ArrayList<>(); // now lets loop over and over until we have done all we can while ((anyNewAnnotations || anyNewParents) && (!decpToRepeat.isEmpty() || !decaToRepeat.isEmpty())) { anyNewParents = anyNewAnnotations = false; @@ -927,7 +927,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC if ((bits & TagBits.AnnotationTargetMASK) == 0) { return ""; } - Set s = new HashSet(); + Set s = new HashSet<>(); if ((bits & TagBits.AnnotationForAnnotationType) != 0) { s.add("ANNOTATION_TYPE"); } diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java index 6e9fafff9..a990767af 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java @@ -95,8 +95,8 @@ public class EclipseFactory { // We can get clashes if we don't treat raw types differently - we end up looking // up a raw and getting the generic type (pr115788) - private final Map typexToBinding = new HashMap(); - private final Map rawTypeXToBinding = new HashMap(); + private final Map typexToBinding = new HashMap<>(); + private final Map rawTypeXToBinding = new HashMap<>(); // XXX currently unused // private Map/*TypeBinding, ResolvedType*/ bindingToResolvedTypeX = new HashMap(); @@ -361,7 +361,7 @@ public class EclipseFactory { /** * Some type variables refer to themselves recursively, this enables us to avoid recursion problems. */ - private static Map typeVariableBindingsInProgress = new HashMap(); + private static Map typeVariableBindingsInProgress = new HashMap<>(); /** * Convert from the eclipse form of type variable (TypeVariableBinding) to the AspectJ form (TypeVariable). @@ -462,7 +462,7 @@ public class EclipseFactory { public void finishTypeMungers() { // make sure that type mungers are - List ret = new ArrayList(); + List ret = new ArrayList<>(); List baseTypeMungers = getWorld().getCrosscuttingMembersSet().getTypeMungers(); // XXX by Andy: why do we mix up the mungers here? it means later we know about two sets @@ -533,7 +533,7 @@ public class EclipseFactory { * Before converting the parts of a methodbinding (params, return type) we store the type variables in this structure, then * should any component of the method binding refer to them, we grab them from the map. */ - private final Map typeVariablesForThisMember = new HashMap(); + private final Map typeVariablesForThisMember = new HashMap<>(); /** * This is a map from typevariablebindings (eclipsey things) to the names the user originally specified in their ITD. For @@ -1003,7 +1003,7 @@ public class EclipseFactory { // map back to the same type binding - this is important later when Eclipse code is processing // a methodbinding trying to come up with possible bindings for the type variables. // key is currently the name of the type variable...is that ok? - private final Map typeVariableToTypeBinding = new HashMap(); + private final Map typeVariableToTypeBinding = new HashMap<>(); // /** // * Converts from an TypeVariableReference to a TypeVariableBinding. A TypeVariableReference diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java index 26c260628..06191629f 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java @@ -157,8 +157,8 @@ public class EclipseScope implements IScope { if (importedNames != null) return; - List importedNamesList = new ArrayList(); - List importedPrefixesList = new ArrayList(); + List importedNamesList = new ArrayList<>(); + List importedPrefixesList = new ArrayList<>(); Scope currentScope = scope; // add any enclosing types to this list diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java index efd4fb0db..1941ad630 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java @@ -101,8 +101,8 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate { protected ResolvedMember[] declaredMethods = null; protected ResolvedMember[] declaredFields = null; - public List declares = new ArrayList(); - public List typeMungers = new ArrayList(); + public List declares = new ArrayList<>(); + public List typeMungers = new ArrayList<>(); private final EclipseFactory factory; @@ -258,9 +258,9 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate { } protected void fillDeclaredMembers() { - List declaredPointcuts = new ArrayList(); - List declaredMethods = new ArrayList(); - List declaredFields = new ArrayList(); + List declaredPointcuts = new ArrayList<>(); + List declaredMethods = new ArrayList<>(); + List declaredFields = new ArrayList<>(); MethodBinding[] ms = binding.methods(); // the important side-effect of this call is to make // sure bindings are completed @@ -610,7 +610,7 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate { // } // return targetKind; if (isAnnotation()) { - List targetKinds = new ArrayList(); + List targetKinds = new ArrayList<>(); if ((binding.getAnnotationTagBits() & TagBits.AnnotationForAnnotationType) != 0) { targetKinds.add(AnnotationTargetKind.ANNOTATION_TYPE); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/HelperInterfaceBinding.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/HelperInterfaceBinding.java index a9c4bd532..e8423c2a4 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/HelperInterfaceBinding.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/HelperInterfaceBinding.java @@ -30,7 +30,7 @@ import org.aspectj.weaver.UnresolvedType; public class HelperInterfaceBinding extends SourceTypeBinding { private UnresolvedType typeX; SourceTypeBinding enclosingType; - List methods = new ArrayList(); + List methods = new ArrayList<>(); public HelperInterfaceBinding(SourceTypeBinding enclosingType, UnresolvedType typeX) { super(); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java index d3e449534..80ffe4222 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java @@ -39,8 +39,8 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; * The member finder looks after intertype declared members on a type, there is one member finder per type that was hit by an ITD. */ public class InterTypeMemberFinder implements IMemberFinder { - private List interTypeFields = new ArrayList(); - private List interTypeMethods = new ArrayList(); + private List interTypeFields = new ArrayList<>(); + private List interTypeMethods = new ArrayList<>(); public SourceTypeBinding sourceTypeBinding; @@ -254,7 +254,7 @@ public class InterTypeMemberFinder implements IMemberFinder { MethodBinding[] orig = sourceTypeBinding.methodsBase(); // if (interTypeMethods.isEmpty()) return orig; - List ret = new ArrayList(Arrays.asList(orig)); + List ret = new ArrayList<>(Arrays.asList(orig)); for (MethodBinding method : interTypeMethods) { ret.add(method); } @@ -299,7 +299,7 @@ public class InterTypeMemberFinder implements IMemberFinder { return orig; } - Set ret = new HashSet(Arrays.asList(orig)); + Set ret = new HashSet<>(Arrays.asList(orig)); // System.err.println("declared method: " + ret + " inters = " + interTypeMethods); for (MethodBinding method : interTypeMethods) { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java index 0f131c62e..7f78e0bea 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java @@ -96,7 +96,7 @@ public class InterTypeScope extends ClassScope { TypeVariableBinding tvb = sourceType.typeVariables()[aliased]; tvb.fPackage = sourceType.fPackage; if (usedAliases == null) - usedAliases = new HashMap(); + usedAliases = new HashMap<>(); usedAliases.put(tvb, variableName); return tvb; } else { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/IntertypeMemberTypeFinder.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/IntertypeMemberTypeFinder.java index 5ba0229dc..3ee6368e5 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/IntertypeMemberTypeFinder.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/IntertypeMemberTypeFinder.java @@ -32,7 +32,7 @@ public class IntertypeMemberTypeFinder implements ITypeFinder { public SourceTypeBinding targetTypeBinding; // The new types declared onto the target - private Set intertypeMemberTypes = new HashSet(); + private Set intertypeMemberTypes = new HashSet<>(); public void addInterTypeMemberType(ReferenceBinding binding) { intertypeMemberTypes.add(binding); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/PushinCollector.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/PushinCollector.java index e3d228e0b..894492bf3 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/PushinCollector.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/PushinCollector.java @@ -65,16 +65,16 @@ public class PushinCollector { private String suffix; // This first collection stores the 'text' for the declarations. - private Map codeRepresentation = new HashMap(); + private Map codeRepresentation = new HashMap<>(); // This stores the new annotations - private Map> additionalAnnotations = new HashMap>(); + private Map> additionalAnnotations = new HashMap<>(); // This stores the new parents - private Map> additionalParents = new HashMap>(); + private Map> additionalParents = new HashMap<>(); // This indicates which types are affected by which intertype declarations - private Map> newDeclarations = new HashMap>(); + private Map> newDeclarations = new HashMap<>(); private PushinCollector(World world, Properties configuration) { this.world = world; @@ -255,7 +255,7 @@ public class PushinCollector { } List amds = newDeclarations.get(sourceType); if (amds == null) { - amds = new ArrayList(); + amds = new ArrayList<>(); newDeclarations.put(sourceType, amds); } amds.add(sourceMethod); @@ -264,7 +264,7 @@ public class PushinCollector { public void tagAsMunged(SourceTypeBinding sourceType, String annotationString) { List annos = additionalAnnotations.get(sourceType); if (annos == null) { - annos = new ArrayList(); + annos = new ArrayList<>(); additionalAnnotations.put(sourceType, annos); } annos.add(annotationString); @@ -322,7 +322,7 @@ public class PushinCollector { if (typePattern instanceof ExactTypePattern) { List annos = additionalParents.get(sourceType); if (annos == null) { - annos = new ArrayList(); + annos = new ArrayList<>(); additionalParents.put(sourceType, annos); } annos.add((ExactTypePattern) typePattern); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java index 4cd844590..cfda72357 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java @@ -55,27 +55,27 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { private File outputJar; private String outxmlName; private CompilationResultDestinationManager compilationResultDestinationManager = null; - private List sourceRoots = new ArrayList(); + private List sourceRoots = new ArrayList<>(); private List changedFiles; - private List files = new ArrayList(); - private List xmlfiles = new ArrayList(); + private List files = new ArrayList<>(); + private List xmlfiles = new ArrayList<>(); private String processor; private String processorPath; - private List binaryFiles = new ArrayList(); // .class files in indirs... - private List inJars = new ArrayList(); - private List inPath = new ArrayList(); - private Map sourcePathResources = new HashMap(); - private List aspectpath = new ArrayList(); - private List classpath = new ArrayList(); - private List modulepath = new ArrayList(); + private List binaryFiles = new ArrayList<>(); // .class files in indirs... + private List inJars = new ArrayList<>(); + private List inPath = new ArrayList<>(); + private Map sourcePathResources = new HashMap<>(); + private List aspectpath = new ArrayList<>(); + private List classpath = new ArrayList<>(); + private List modulepath = new ArrayList<>(); // Expensive to compute (searching modules, parsing module-info) private ArrayList modulepathClasspathEntries = null; - private List modulesourcepath = new ArrayList(); + private List modulesourcepath = new ArrayList<>(); // Expensive to compute (searching modules, parsing module-info) private ArrayList modulesourcepathClasspathEntries = null; private Classpath[] checkedClasspaths = null; - private List bootclasspath = new ArrayList(); - private List cpElementsWithModifiedContents = new ArrayList(); + private List bootclasspath = new ArrayList<>(); + private List cpElementsWithModifiedContents = new ArrayList<>(); private IModule moduleDesc; private File configFile; @@ -251,7 +251,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { } private List processFilePath(List path, java.lang.String encoding) { - List entries = new ArrayList(); + List entries = new ArrayList<>(); for (File file: path) { entries.add(FileSystem.getClasspath(file.getAbsolutePath(), encoding, null, ClasspathLocation.BINARY, null)); } @@ -259,7 +259,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { } private List processStringPath(List path, java.lang.String encoding) { - List entries = new ArrayList(); + List entries = new ArrayList<>(); for (String file: path) { entries.add(FileSystem.getClasspath(file, encoding, null, ClasspathLocation.BINARY, null)); } @@ -317,7 +317,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { public void processInPath() { // remember all the class files in directories on the inpath - binaryFiles = new ArrayList(); + binaryFiles = new ArrayList<>(); FileFilter filter = new FileFilter() { @Override public boolean accept(File pathname) { @@ -377,7 +377,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { * classpath), and output dir or jar */ public List getFullClasspath() { - List full = new ArrayList(); + List full = new ArrayList<>(); full.addAll(getBootclasspath()); // XXX Is it OK that boot classpath overrides inpath/injars/aspectpath? for (File file: inJars) { full.add(file.getAbsolutePath()); @@ -581,7 +581,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { // Possibly a name=value comma separated list of configurations if (lintMode.contains("=")) { this.lintMode = AJLINT_DEFAULT; - lintOptionsMap = new HashMap(); + lintOptionsMap = new HashMap<>(); StringTokenizer tokenizer = new StringTokenizer(lintMode,","); while (tokenizer.hasMoreElements()) { String option = tokenizer.nextToken(); @@ -596,7 +596,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { } if (lintValue != null || lintOptionsMap != null ) { - Map lintOptions = new HashMap(); + Map lintOptions = new HashMap<>(); setOption(AjCompilerOptions.OPTION_ReportInvalidAbsoluteTypeName, lintValue, lintOptions); setOption(AjCompilerOptions.OPTION_ReportInvalidWildcardTypeName, lintValue, lintOptions); setOption(AjCompilerOptions.OPTION_ReportUnresolvableMember, lintValue, lintOptions); @@ -930,7 +930,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { // What to do about bootclasspath on java 9? // ArrayList allPaths = handleBootclasspath(bootclasspaths, customEncoding); - ArrayList allPaths = new ArrayList(); + ArrayList allPaths = new ArrayList<>(); allPaths.addAll(processStringPath(bootclasspath, encoding)); allPaths.addAll(processFilePath(inJars, encoding)); allPaths.addAll(processFilePath(inPath, encoding)); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index dfdcba12c..9510bec56 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -138,7 +138,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour private boolean batchCompile = true; private INameEnvironment environment; - private Map> /* String -> List */binarySourcesForTheNextCompile = new HashMap>(); + private Map> /* String -> List */binarySourcesForTheNextCompile = new HashMap<>(); // FIXME asc should this really be in here? // private AsmManager structureModel; @@ -708,7 +708,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour * aspects which are sent to that ouptut directory */ private Map> findOutputDirsForAspects() { - Map> outputDirsToAspects = new HashMap>(); + Map> outputDirsToAspects = new HashMap<>(); Map aspectNamesToFileNames = state.getAspectNamesToFileNameMap(); if (buildConfig.getCompilationResultDestinationManager() == null || buildConfig.getCompilationResultDestinationManager().getAllOutputLocations().size() == 1) { @@ -717,7 +717,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour if (buildConfig.getCompilationResultDestinationManager() != null) { outputDir = buildConfig.getCompilationResultDestinationManager().getDefaultOutputLocation(); } - List aspectNames = new ArrayList(); + List aspectNames = new ArrayList<>(); if (aspectNamesToFileNames != null) { Set keys = aspectNamesToFileNames.keySet(); for (String name : keys) { @@ -729,7 +729,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour List outputDirs = buildConfig.getCompilationResultDestinationManager().getAllOutputLocations(); for (Object dir : outputDirs) { File outputDir = (File) dir; - outputDirsToAspects.put(outputDir, new ArrayList()); + outputDirsToAspects.put(outputDir, new ArrayList<>()); } if (aspectNamesToFileNames != null) { Set> entrySet = aspectNamesToFileNames.entrySet(); @@ -739,7 +739,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour File outputDir = buildConfig.getCompilationResultDestinationManager().getOutputLocationForClass( new File(new String(fileName))); if (!outputDirsToAspects.containsKey(outputDir)) { - outputDirsToAspects.put(outputDir, new ArrayList()); + outputDirsToAspects.put(outputDir, new ArrayList<>()); } ((List) outputDirsToAspects.get(outputDir)).add(aspectName); } @@ -796,7 +796,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } model.setRoot(new ProgramElement(structureModel, rootLabel, kind, new ArrayList())); - model.setFileMap(new HashMap()); + model.setFileMap(new HashMap<>()); // setStructureModel(model); state.setStructureModel(structureModel); // state.setRelationshipMap(AsmManager.getDefault().getRelationshipMap()); @@ -903,7 +903,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour File[] binSrcs = FileUtil.listFiles(inPathElement, binarySourceFilter); for (File binSrc : binSrcs) { UnwovenClassFile ucf = bcelWeaver.addClassFile(binSrc, inPathElement, outputDir); - List ucfl = new ArrayList(); + List ucfl = new ArrayList<>(); ucfl.add(ucf); state.recordBinarySource(binSrc.getPath(), ucfl); } diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java index f4518ead3..18fa2f96d 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java @@ -96,7 +96,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe * When looking at changes on the classpath, this set accumulates files in our state instance that affected by those changes. * Then if we can do an incremental build - these must be compiled. */ - private final Set affectedFiles = new HashSet(); + private final Set affectedFiles = new HashSet<>(); // these are references created on a particular compile run - when looping round in // addAffectedSourceFiles(), if some have been created then we look at which source files @@ -110,7 +110,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe private Set addedBinaryFiles; private Set deletedBinaryFiles; // For a particular build run, this set records the changes to classesFromName - public final Set deltaAddedClasses = new HashSet(); + public final Set deltaAddedClasses = new HashSet<>(); // now follows non static, but transient state - no need to write out, DOES need reinitializing when read AjState instance // reloaded @@ -125,7 +125,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe private boolean batchBuildRequiredThisTime = false; private AjBuildConfig buildConfig; private long lastSuccessfulFullBuildTime = -1; - private final Hashtable structuralChangesSinceLastFullBuild = new Hashtable(); + private final Hashtable structuralChangesSinceLastFullBuild = new Hashtable<>(); private long lastSuccessfulBuildTime = -1; private long currentBuildTime = -1; private AsmManager structureModel; @@ -134,18 +134,18 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe * For a given source file, records the ClassFiles (which contain a fully qualified name and a file name) that were created when * the source file was compiled. Populated in noteResult and used in addDependentsOf(File) */ - private final Map> fullyQualifiedTypeNamesResultingFromCompilationUnit = new HashMap>(); + private final Map> fullyQualifiedTypeNamesResultingFromCompilationUnit = new HashMap<>(); /** * Source files defining aspects Populated in noteResult and used in processDeletedFiles */ - private final Set sourceFilesDefiningAspects = new HashSet(); + private final Set sourceFilesDefiningAspects = new HashSet<>(); /** * Populated in noteResult to record the set of types that should be recompiled if the given file is modified or deleted. * Referred to during addAffectedSourceFiles when calculating incremental compilation set. */ - private final Map references = new HashMap(); + private final Map references = new HashMap<>(); /** * Holds UnwovenClassFiles (byte[]s) originating from the given file source. This could be a jar file, a directory, or an @@ -165,25 +165,25 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe * input file has changed. * */ - private Map> binarySourceFiles = new HashMap>(); + private Map> binarySourceFiles = new HashMap<>(); /** * Initially a duplicate of the information held in binarySourceFiles, with the key difference that the values are ClassFiles * (type name, File) not UnwovenClassFiles (which also have all the byte code in them). After a batch build, binarySourceFiles * is cleared, leaving just this much lighter weight map to use in processing subsequent incremental builds. */ - private final Map> inputClassFilesBySource = new HashMap>(); + private final Map> inputClassFilesBySource = new HashMap<>(); /** * A list of the .class files created by this state that contain aspects. */ - private final List aspectClassFiles = new ArrayList(); + private final List aspectClassFiles = new ArrayList<>(); /** * Holds structure information on types as they were at the end of the last build. It would be nice to get rid of this too, but * can't see an easy way to do that right now. */ - private final Map resolvedTypeStructuresFromLastBuild = new HashMap(); + private final Map resolvedTypeStructuresFromLastBuild = new HashMap<>(); /** * Populated in noteResult to record the set of UnwovenClassFiles (intermediate results) that originated from compilation of the @@ -193,7 +193,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe * * Passed into StatefulNameEnvironment during incremental compilation to support findType lookups. */ - private final Map classesFromName = new HashMap(); + private final Map classesFromName = new HashMap<>(); /** * Populated by AjBuildManager to record the aspects with the file name in which they're contained. This is later used when @@ -203,8 +203,8 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe */ private Map aspectsFromFileNames; - private Set compiledSourceFiles = new HashSet(); - private final Map resources = new HashMap(); + private Set compiledSourceFiles = new HashSet<>(); + private final Map resources = new HashMap<>(); SoftHashMap/* > */fileToClassNameMap = new SoftHashMap(); @@ -313,21 +313,21 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe addedFiles = Collections.emptySet(); deletedFiles = Collections.emptySet(); } else { - Set oldFiles = new HashSet(buildConfig.getFiles()); - Set newFiles = new HashSet(newBuildConfig.getFiles()); + Set oldFiles = new HashSet<>(buildConfig.getFiles()); + Set newFiles = new HashSet<>(newBuildConfig.getFiles()); - addedFiles = new HashSet(newFiles); + addedFiles = new HashSet<>(newFiles); addedFiles.removeAll(oldFiles); - deletedFiles = new HashSet(oldFiles); + deletedFiles = new HashSet<>(oldFiles); deletedFiles.removeAll(newFiles); } - Set oldBinaryFiles = new HashSet(buildConfig.getBinaryFiles()); - Set newBinaryFiles = new HashSet(newBuildConfig.getBinaryFiles()); + Set oldBinaryFiles = new HashSet<>(buildConfig.getBinaryFiles()); + Set newBinaryFiles = new HashSet<>(newBuildConfig.getBinaryFiles()); - addedBinaryFiles = new HashSet(newBinaryFiles); + addedBinaryFiles = new HashSet<>(newBinaryFiles); addedBinaryFiles.removeAll(oldBinaryFiles); - deletedBinaryFiles = new HashSet(oldBinaryFiles); + deletedBinaryFiles = new HashSet<>(oldBinaryFiles); deletedBinaryFiles.removeAll(newBinaryFiles); boolean couldStillBeIncremental = processDeletedFiles(deletedFiles); @@ -376,7 +376,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe } Collection getModifiedFiles(long lastBuildTime) { - Set ret = new HashSet(); + Set ret = new HashSet<>(); // Check if the build configuration knows what files have changed... List modifiedFiles = buildConfig.getModifiedFiles(); @@ -408,7 +408,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe } Collection getModifiedBinaryFiles(long lastBuildTime) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); // not our job to account for new and deleted files for (BinarySourceFile bsfile : buildConfig.getBinaryFiles()) { File file = bsfile.binSrc; @@ -865,7 +865,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe if ((changes & (CLASSPATH_CHANGED | ASPECTPATH_CHANGED | INPATH_CHANGED | OUTPUTDESTINATIONS_CHANGED | INJARS_CHANGED)) != 0) { List oldOutputLocs = getOutputLocations(previousConfig); - Set alreadyAnalysedPaths = new HashSet(); + Set alreadyAnalysedPaths = new HashSet<>(); List oldClasspath = previousConfig.getClasspath(); List newClasspath = newConfig.getClasspath(); @@ -926,7 +926,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe * @return a list of file objects */ private List getOutputLocations(AjBuildConfig config) { - List outputLocs = new ArrayList(); + List outputLocs = new ArrayList<>(); // Is there a default location? if (config.getOutputDir() != null) { try { @@ -1074,9 +1074,9 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe } public Set getFilesToCompile(boolean firstPass) { - Set thisTime = new HashSet(); + Set thisTime = new HashSet<>(); if (firstPass) { - compiledSourceFiles = new HashSet(); + compiledSourceFiles = new HashSet<>(); Collection modifiedFiles = getModifiedFiles(); // System.out.println("modified: " + modifiedFiles); thisTime.addAll(modifiedFiles); @@ -1120,9 +1120,9 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe return binarySourceFiles; } // else incremental... - Map> toWeave = new HashMap>(); + Map> toWeave = new HashMap<>(); if (firstTime) { - List addedOrModified = new ArrayList(); + List addedOrModified = new ArrayList<>(); addedOrModified.addAll(addedBinaryFiles); addedOrModified.addAll(getModifiedBinaryFiles()); for (BinarySourceFile bsf : addedOrModified) { @@ -1130,11 +1130,11 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe if (ucf == null) { continue; } - List ucfs = new ArrayList(); + List ucfs = new ArrayList<>(); ucfs.add(ucf); recordTypeChanged(ucf.getClassName()); binarySourceFiles.put(bsf.binSrc.getPath(), ucfs); - List cfs = new ArrayList(1); + List cfs = new ArrayList<>(1); cfs.add(getClassFileFor(ucf)); this.inputClassFilesBySource.put(bsf.binSrc.getPath(), cfs); toWeave.put(bsf.binSrc.getPath(), ucfs); @@ -1407,7 +1407,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe * @param icr, the CompilationResult from compiling it */ private void recordFQNsResultingFromCompilationUnit(File sourceFile, InterimCompilationResult icr) { - List classFiles = new ArrayList(); + List classFiles = new ArrayList<>(); UnwovenClassFile[] types = icr.unwovenClassFiles(); for (UnwovenClassFile type : types) { classFiles.add(new ClassFile(type.getClassName(), new File(type.getFilename()))); @@ -2372,13 +2372,13 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe } public void clearBinarySourceFiles() { - this.binarySourceFiles = new HashMap>(); + this.binarySourceFiles = new HashMap<>(); } public void recordBinarySource(String fromPathName, List unwovenClassFiles) { this.binarySourceFiles.put(fromPathName, unwovenClassFiles); if (this.maybeIncremental()) { - List simpleClassFiles = new LinkedList(); + List simpleClassFiles = new LinkedList<>(); for (UnwovenClassFile ucf : unwovenClassFiles) { ClassFile cf = getClassFileFor(ucf); simpleClassFiles.add(cf); @@ -2489,7 +2489,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe } public void initializeAspectNamesToFileNameMap() { - this.aspectsFromFileNames = new HashMap(); + this.aspectsFromFileNames = new HashMap<>(); } // Will allow us to record decisions made during incremental processing, hopefully aid in debugging diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java index 776696aff..a89a6bd93 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java @@ -422,9 +422,9 @@ public class AsmElementFormatter { pe.setParameterNames(Collections.emptyList()); pe.setParameterSignatures(Collections.emptyList(), Collections.emptyList()); } else { - List names = new ArrayList(); - List paramSigs = new ArrayList(); - List paramSourceRefs = new ArrayList(); + List names = new ArrayList<>(); + List paramSigs = new ArrayList<>(); + List paramSourceRefs = new ArrayList<>(); boolean problemWithSourceRefs = false; for (Argument argument : argArray) { String argName = new String(argument.name); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java index 7ee6cf9e4..84319600c 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java @@ -541,7 +541,7 @@ public class AsmHierarchyBuilder extends ASTVisitor { Declare decl = dDeclaration.declareDecl; if (decl instanceof DeclareParents) { TypePatternList tpl = ((DeclareParents) decl).getParents(); - List parents = new ArrayList(); + List parents = new ArrayList<>(); for (int i = 0; i < tpl.size(); i++) { parents.add(tpl.get(i).getExactType().getName().replaceAll("\\$", ".")); } diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/IncrementalStateManager.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/IncrementalStateManager.java index aeac71571..f81d1d937 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/IncrementalStateManager.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/IncrementalStateManager.java @@ -39,7 +39,7 @@ public class IncrementalStateManager { // SECRETAPI will consume more memory, so turn on at your own risk ;) Set to 'true' when memory usage is understood public static boolean recordIncrementalStates = false; public static boolean debugIncrementalStates = false; - private static Hashtable incrementalStates = new Hashtable(); + private static Hashtable incrementalStates = new Hashtable<>(); public static void recordSuccessfulBuild(String buildConfig, AjState state) { if (!recordIncrementalStates) { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java index 97284639a..8d49c31d1 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java @@ -39,10 +39,10 @@ public class StatefulNameEnvironment implements IModuleAwareNameEnvironment { public StatefulNameEnvironment(IModuleAwareNameEnvironment baseEnvironment, Map classesFromName, AjState state) { this.classesFromName = classesFromName; - this.inflatedClassFilesCache = new HashMap(); + this.inflatedClassFilesCache = new HashMap<>(); this.baseEnvironment = baseEnvironment; this.state = state; - packageNames = new HashSet(); + packageNames = new HashSet<>(); for (String className: classesFromName.keySet()) { addAllPackageNames(className); } diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java index 53053d8b3..1a3cc12b2 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java @@ -62,7 +62,7 @@ public abstract class CommandTestCase extends TestCase { } public static void checkCompile(String source, String[] extraArgs, int[] expectedErrors, String sandboxName) { - List args = new ArrayList(); + List args = new ArrayList<>(); args.add("-verbose"); args.add("-d"); @@ -87,7 +87,7 @@ public abstract class CommandTestCase extends TestCase { } public void checkMultipleCompile(String source) throws InterruptedException { - List args = new ArrayList(); + List args = new ArrayList<>(); args.add("-verbose"); args.add("-d"); diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java index 9f1162c9f..355267b0f 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java @@ -236,7 +236,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests? "-d", classesDir.getAbsolutePath()}; return Collections.unmodifiableList( - new ArrayList(Arrays.asList(input))); + new ArrayList<>(Arrays.asList(input))); } protected File makeDir( diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java index a9ee51fe9..bea58ff7b 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java @@ -37,7 +37,7 @@ public class JavadocTest extends AjcTestCase { public void testMissingJavadoc() { String[] args = new String[] { "World.java", "-warn:allJavadoc", "-1.4" }; - List warningMessages = new ArrayList(); + List warningMessages = new ArrayList<>(); // These warnings are against public textX() methods declared in the World.java // type. These test methods are spread between AJ constructs, meaning // if someone messes up and the javadoc is not associated with the aspectj diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfigTest.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfigTest.java index 880d58f86..a8b2964c4 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfigTest.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfigTest.java @@ -166,7 +166,7 @@ public class AjBuildConfigTest extends TestCase { static class TestMessageHandler implements IMessageHandler { - List messages = new ArrayList(); + List messages = new ArrayList<>(); @Override public boolean isIgnoring(Kind kind) { diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/core/builder/AjStateTest.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/core/builder/AjStateTest.java index 101fdade1..1cd4ade77 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/core/builder/AjStateTest.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/core/builder/AjStateTest.java @@ -119,26 +119,26 @@ public class AjStateTest extends TestCase { }); oldConfig = new AjBuildConfig(parser); newConfig = new AjBuildConfig(parser); - List cp = new ArrayList(); + List cp = new ArrayList<>(); cp.add("adir"); cp.add("ajar.jar"); oldConfig.setClasspath(cp); - newConfig.setClasspath(new ArrayList(cp)); - List ap = new ArrayList(); + newConfig.setClasspath(new ArrayList<>(cp)); + List ap = new ArrayList<>(); ap.add(new File("aLib.jar")); ap.add(new File("anotherLib.jar")); oldConfig.setAspectpath(ap); - newConfig.setAspectpath(new ArrayList(ap)); - List ip = new ArrayList(); + newConfig.setAspectpath(new ArrayList<>(ap)); + List ip = new ArrayList<>(); ip.add(new File("adir")); ip.add(new File("ajar.jar")); oldConfig.setInPath(ip); - newConfig.setInPath(new ArrayList(ip)); - List ij = new ArrayList(); + newConfig.setInPath(new ArrayList<>(ip)); + List ij = new ArrayList<>(); ij.add(new File("aLib.jar")); ij.add(new File("anotherLib.jar")); oldConfig.setInJars(ij); - newConfig.setInJars(new ArrayList(ij)); + newConfig.setInJars(new ArrayList<>(ij)); aRightState.prepareForNextBuild(oldConfig); aRightState.successfulCompile(oldConfig, true); } diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/ASTVisitorTest.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/ASTVisitorTest.java index e63ecf15e..de8960e73 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/ASTVisitorTest.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/ASTVisitorTest.java @@ -421,7 +421,7 @@ public class ASTVisitorTest extends TestCase { private void checkJLS3(String source, String expectedOutput) { ASTParser parser = ASTParser.newParser(AST.JLS3); - HashMap options = new HashMap(); + HashMap options = new HashMap<>(); options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); parser.setCompilerOptions(options); parser.setSource(source.toCharArray()); diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTest.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTest.java index e4c49b48c..721cb3e22 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTest.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTest.java @@ -1848,7 +1848,7 @@ class TypeCategoryTypeVisitor extends AjASTVisitor { } class TypePatternSourceRangeVisitor extends AjASTVisitor { - private List sourceRanges = new ArrayList(); + private List sourceRanges = new ArrayList<>(); public List getVisitedSourceRanges() { return sourceRanges; diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTestCase.java index b3870c6e8..304a7996b 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjASTTestCase.java @@ -86,7 +86,7 @@ public abstract class AjASTTestCase extends TestCase { protected List getSourceRanges(int[][] sourceRanges) { - List convertedRanges = new ArrayList(); + List convertedRanges = new ArrayList<>(); for (int[] sourceRange : sourceRanges) { convertedRanges.add(new SourceRange(sourceRange[0], diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java index 671b310cc..088ff78f9 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java @@ -209,11 +209,11 @@ public class Ajc { System.setOut(pout); System.setErr(perr); - List fails = new ArrayList(); - List errors = new ArrayList(); - List warnings = new ArrayList(); - List infos = new ArrayList(); - List weaves = new ArrayList(); + List fails = new ArrayList<>(); + List errors = new ArrayList<>(); + List warnings = new ArrayList<>(); + List infos = new ArrayList<>(); + List weaves = new ArrayList<>(); try { if (!isIncremental && shouldEmptySandbox) { diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java index 6bbc076b4..5488ab1b2 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java @@ -493,7 +493,7 @@ public abstract class AjcTestCase extends TestCase { * Helper method to build a new message list for passing to a MessageSpec. */ protected List newMessageList(Message m1) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); ret.add(m1); return ret; } @@ -502,7 +502,7 @@ public abstract class AjcTestCase extends TestCase { * Helper method to build a new message list for passing to a MessageSpec. */ protected List newMessageList(Message m1, Message m2) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); ret.add(m1); ret.add(m2); return ret; @@ -512,7 +512,7 @@ public abstract class AjcTestCase extends TestCase { * Helper method to build a new message list for passing to a MessageSpec. */ protected List newMessageList(Message m1, Message m2, Message m3) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); ret.add(m1); ret.add(m2); ret.add(m3); @@ -785,7 +785,7 @@ public abstract class AjcTestCase extends TestCase { private ListtokenizeCommand(String command) { StringTokenizer st = new StringTokenizer(command," ", false); - ArrayList arguments = new ArrayList(); + ArrayList arguments = new ArrayList<>(); while(st.hasMoreElements()){ String nextToken =st.nextToken(); arguments.add(nextToken); @@ -959,7 +959,7 @@ public abstract class AjcTestCase extends TestCase { if (in == Collections.EMPTY_LIST) return in; - List out = new ArrayList(); + List out = new ArrayList<>(); for (T t : in) { out.add(t); } diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/MainTest.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/MainTest.java index 8d6f788d4..7da3aa647 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/MainTest.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/MainTest.java @@ -23,7 +23,7 @@ import org.aspectj.bridge.AbortException; public class MainTest extends AjcTestCase { public void testMainbare() { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); // Usage now printed by Eclipse compiler so doesn't appear here in our message list // Main.bareMain(new String[] {"-help"}, false, list, null, null, null); // assertTrue(1 == list.size()); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java index ce3b6aa60..2d969c2f8 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java @@ -112,7 +112,7 @@ public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDele } protected GenericSignature.FormalTypeParameter[] getFormalTypeParametersFromOuterClass() { - List typeParameters = new ArrayList(); + List typeParameters = new ArrayList<>(); ResolvedType outerClassType = getOuterClass(); if (!(outerClassType instanceof ReferenceType)) { if (outerClassType == null) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java index b6ddd2e6e..c3f22b0b1 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java @@ -50,21 +50,21 @@ public class CrosscuttingMembers { private PerClause perClause; - private List shadowMungers = new ArrayList(4); - private List typeMungers = new ArrayList(4); - private List lateTypeMungers = new ArrayList(0); + private List shadowMungers = new ArrayList<>(4); + private List typeMungers = new ArrayList<>(4); + private List lateTypeMungers = new ArrayList<>(0); - private Set declareParents = new HashSet(); - private Set declareSofts = new HashSet(); - private List declareDominates = new ArrayList(4); + private Set declareParents = new HashSet<>(); + private Set declareSofts = new HashSet<>(); + private List declareDominates = new ArrayList<>(4); // These are like declare parents type mungers - private Set declareAnnotationsOnType = new LinkedHashSet(); - private Set declareAnnotationsOnField = new LinkedHashSet(); - private Set declareAnnotationsOnMethods = new LinkedHashSet(); + private Set declareAnnotationsOnType = new LinkedHashSet<>(); + private Set declareAnnotationsOnField = new LinkedHashSet<>(); + private Set declareAnnotationsOnMethods = new LinkedHashSet<>(); // declareAnnotationsOnMethods includes constructors too - private Set declareTypeEow = new HashSet(); + private Set declareTypeEow = new HashSet<>(); private boolean shouldConcretizeIfNeeded = true; @@ -74,8 +74,8 @@ public class CrosscuttingMembers { this.shouldConcretizeIfNeeded = shouldConcretizeIfNeeded; } - private final Hashtable cflowFields = new Hashtable(); - private final Hashtable cflowBelowFields = new Hashtable(); + private final Hashtable cflowFields = new Hashtable<>(); + private final Hashtable cflowBelowFields = new Hashtable<>(); // public void addConcreteShadowMungers(Collection c) { // shadowMungers.addAll(c); @@ -237,7 +237,7 @@ public class CrosscuttingMembers { } public Collection getCflowEntries() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (ShadowMunger m : shadowMungers) { if (m instanceof Advice) { Advice a = (Advice) m; @@ -276,8 +276,8 @@ public class CrosscuttingMembers { if (careAboutShadowMungers) { // bug 129163: use set equality rather than list equality - Set theseShadowMungers = new HashSet(); - Set theseInlinedAroundMungers = new HashSet(); + Set theseShadowMungers = new HashSet<>(); + Set theseInlinedAroundMungers = new HashSet<>(); for (ShadowMunger munger : shadowMungers) { if (munger instanceof Advice) { Advice adviceMunger = (Advice) munger; @@ -293,10 +293,10 @@ public class CrosscuttingMembers { theseShadowMungers.add(munger); } } - Set tempSet = new HashSet(); + Set tempSet = new HashSet<>(); tempSet.addAll(other.shadowMungers); - Set otherShadowMungers = new HashSet(); - Set otherInlinedAroundMungers = new HashSet(); + Set otherShadowMungers = new HashSet<>(); + Set otherInlinedAroundMungers = new HashSet<>(); for (ShadowMunger munger : tempSet) { if (munger instanceof Advice) { Advice adviceMunger = (Advice) munger; @@ -341,8 +341,8 @@ public class CrosscuttingMembers { // if we dont care about shadow mungers then ignore those // typeMungers which are created to help with the implementation // of shadowMungers - Set theseTypeMungers = new HashSet(); - Set otherTypeMungers = new HashSet(); + Set theseTypeMungers = new HashSet<>(); + Set otherTypeMungers = new HashSet<>(); if (!careAboutShadowMungers) { for (Object o : typeMungers) { if (o instanceof ConcreteTypeMunger) { @@ -431,13 +431,13 @@ public class CrosscuttingMembers { // the up front comparison if (!careAboutShadowMungers) { // this means we are in front end compilation and if the differences are purely mixin parents, we can continue OK - Set trimmedThis = new HashSet(); + Set trimmedThis = new HashSet<>(); for (DeclareParents decp : declareParents) { if (!decp.isMixin()) { trimmedThis.add(decp); } } - Set trimmedOther = new HashSet(); + Set trimmedOther = new HashSet<>(); for (DeclareParents decp : other.declareParents) { if (!decp.isMixin()) { trimmedOther.add(decp); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java index a3d97ea89..79f96e8fa 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java @@ -43,7 +43,7 @@ public class CrosscuttingMembersSet { private transient World world; // FIXME AV - ? we may need a sequencedHashMap there to ensure source based precedence for @AJ advice - private final Map members = new HashMap(); + private final Map members = new HashMap<>(); // List of things to be verified once the type system is 'complete' private transient List verificationList = null; @@ -139,7 +139,7 @@ public class CrosscuttingMembersSet { private boolean addOrReplaceDescendantsOf(ResolvedType aspectType, boolean inWeavePhase) { // System.err.println("Looking at descendants of "+aspectType.getName()); Set knownAspects = members.keySet(); - Set toBeReplaced = new HashSet(); + Set toBeReplaced = new HashSet<>(); for (ResolvedType candidateDescendant : knownAspects) { // allowMissing = true - if something is missing, it really probably is not a descendant if ((candidateDescendant != aspectType) && (aspectType.isAssignableFrom(candidateDescendant, true))) { @@ -192,7 +192,7 @@ public class CrosscuttingMembersSet { public List getShadowMungers() { if (shadowMungers == null) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getShadowMungers()); } @@ -203,7 +203,7 @@ public class CrosscuttingMembersSet { public List getTypeMungers() { if (typeMungers == null) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (CrosscuttingMembers xmembers : members.values()) { // With 1.6.9 there is a change that enables use of more optimal accessors (accessors for private fields). // Here is where we determine if two aspects are asking for access to the same field. If they are @@ -252,7 +252,7 @@ public class CrosscuttingMembersSet { for (ConcreteTypeMunger typeMunger : typeMungers) { if (typeMunger.getMunger() != null && typeMunger.getMunger().getKind() == kind) { if (collected == null) { - collected = new ArrayList(); + collected = new ArrayList<>(); } collected.add(typeMunger); } @@ -280,7 +280,7 @@ public class CrosscuttingMembersSet { public List getLateTypeMungers() { if (lateTypeMungers == null) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getLateTypeMungers()); } @@ -291,11 +291,11 @@ public class CrosscuttingMembersSet { public List getDeclareSofts() { if (declareSofts == null) { - Set ret = new HashSet(); + Set ret = new HashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareSofts()); } - declareSofts = new ArrayList(); + declareSofts = new ArrayList<>(); declareSofts.addAll(ret); } return declareSofts; @@ -303,11 +303,11 @@ public class CrosscuttingMembersSet { public List getDeclareParents() { if (declareParents == null) { - Set ret = new HashSet(); + Set ret = new HashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareParents()); } - declareParents = new ArrayList(); + declareParents = new ArrayList<>(); declareParents.addAll(ret); } return declareParents; @@ -318,11 +318,11 @@ public class CrosscuttingMembersSet { */ public List getDeclareAnnotationOnTypes() { if (declareAnnotationOnTypes == null) { - Set ret = new LinkedHashSet(); + Set ret = new LinkedHashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareAnnotationOnTypes()); } - declareAnnotationOnTypes = new ArrayList(); + declareAnnotationOnTypes = new ArrayList<>(); declareAnnotationOnTypes.addAll(ret); } return declareAnnotationOnTypes; @@ -333,11 +333,11 @@ public class CrosscuttingMembersSet { */ public List getDeclareAnnotationOnFields() { if (declareAnnotationOnFields == null) { - Set ret = new LinkedHashSet(); + Set ret = new LinkedHashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareAnnotationOnFields()); } - declareAnnotationOnFields = new ArrayList(); + declareAnnotationOnFields = new ArrayList<>(); declareAnnotationOnFields.addAll(ret); } return declareAnnotationOnFields; @@ -348,11 +348,11 @@ public class CrosscuttingMembersSet { */ public List getDeclareAnnotationOnMethods() { if (declareAnnotationOnMethods == null) { - Set ret = new LinkedHashSet(); + Set ret = new LinkedHashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareAnnotationOnMethods()); } - declareAnnotationOnMethods = new ArrayList(); + declareAnnotationOnMethods = new ArrayList<>(); declareAnnotationOnMethods.addAll(ret); // world.sortDeclareAnnotations(declareAnnotationOnMethods); } @@ -364,11 +364,11 @@ public class CrosscuttingMembersSet { */ public List getDeclareTypeEows() { if (declareTypeEows == null) { - Set ret = new HashSet(); + Set ret = new HashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareTypeErrorOrWarning()); } - declareTypeEows = new ArrayList(); + declareTypeEows = new ArrayList<>(); declareTypeEows.addAll(ret); } return declareTypeEows; @@ -376,7 +376,7 @@ public class CrosscuttingMembersSet { public List getDeclareDominates() { if (declareDominates == null) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareDominates()); } @@ -412,7 +412,7 @@ public class CrosscuttingMembersSet { */ public void recordNecessaryCheck(IVerificationRequired verification) { if (verificationList == null) { - verificationList = new ArrayList(); + verificationList = new ArrayList<>(); } verificationList.add(verification); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/IntMap.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/IntMap.java index c0af738ba..fb86ee4f0 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/IntMap.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/IntMap.java @@ -24,7 +24,7 @@ public class IntMap { // XXX begin hack to avoid a signature refactoring in Pointcut private ResolvedType concreteAspect; private ShadowMunger enclosingAdvice; - private List enclosingDefinition = new ArrayList(); + private List enclosingDefinition = new ArrayList<>(); public void pushEnclosingDefinition(ResolvedPointcutDefinition def) { enclosingDefinition.add(def); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Iterators.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Iterators.java index 1a2e82006..576ef9e34 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Iterators.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Iterators.java @@ -46,7 +46,7 @@ public final class Iterators { */ public static Filter dupFilter() { return new Filter() { - final Set seen = new HashSet(); // should have weak ptrs? + final Set seen = new HashSet<>(); // should have weak ptrs? public Iterator filter(final Iterator in) { return new Iterator() { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/JoinPointSignatureIterator.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/JoinPointSignatureIterator.java index 50332c1c0..639e4a080 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/JoinPointSignatureIterator.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/JoinPointSignatureIterator.java @@ -31,12 +31,12 @@ public class JoinPointSignatureIterator implements Iterator private Member signaturesOfMember; private ResolvedMember firstDefiningMember; private World world; - private List discoveredSignatures = new ArrayList(); + private List discoveredSignatures = new ArrayList<>(); private List additionalSignatures = Collections.emptyList(); private Iterator discoveredSignaturesIterator = null; private Iterator superTypeIterator = null; private boolean isProxy = false; - private Set visitedSuperTypes = new HashSet(); + private Set visitedSuperTypes = new HashSet<>(); private List yetToBeProcessedSuperMembers = null; private boolean iteratingOverDiscoveredSignatures = true; @@ -131,7 +131,7 @@ public class JoinPointSignatureIterator implements Iterator // a common case discoveredSignatures.add(new JoinPointSignature(firstDefiningMember, originalDeclaringType)); } else { - List declaringTypes = new ArrayList(); + List declaringTypes = new ArrayList<>(); accumulateTypesInBetween(originalDeclaringType, firstDefiningType, declaringTypes); for (ResolvedType declaringType : declaringTypes) { discoveredSignatures.add(new JoinPointSignature(firstDefiningMember, declaringType)); @@ -192,7 +192,7 @@ public class JoinPointSignatureIterator implements Iterator ResolvedMemberImpl foundMember = (ResolvedMemberImpl) superType.lookupResolvedMember(firstDefiningMember, true, isProxy); if (foundMember != null && isVisibleTo(firstDefiningMember, foundMember)) { - List declaringTypes = new ArrayList(); + List declaringTypes = new ArrayList<>(); // declaring type can be unresolved if the member can from an ITD... ResolvedType resolvedDeclaringType = foundMember.getDeclaringType().resolve(world); accumulateTypesInBetween(superType, resolvedDeclaringType, declaringTypes); @@ -206,7 +206,7 @@ public class JoinPointSignatureIterator implements Iterator member = new JoinPointSignature(foundMember, declaringType); discoveredSignatures.add(member); // for next time we are reset if (additionalSignatures == Collections.EMPTY_LIST) { - additionalSignatures = new ArrayList(); + additionalSignatures = new ArrayList<>(); } additionalSignatures.add(member); // for this time } @@ -216,12 +216,12 @@ public class JoinPointSignatureIterator implements Iterator foundMember.declaringType.resolve(world)); discoveredSignatures.add(member); // for next time we are reset if (additionalSignatures == Collections.EMPTY_LIST) { - additionalSignatures = new ArrayList(); + additionalSignatures = new ArrayList<>(); } additionalSignatures.add(member); // for this time } if (yetToBeProcessedSuperMembers == null) { - yetToBeProcessedSuperMembers = new ArrayList(); + yetToBeProcessedSuperMembers = new ArrayList<>(); } yetToBeProcessedSuperMembers.add(new SearchPair(foundMember, superType)); return true; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java index 7307ab93c..216186b26 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java @@ -30,7 +30,7 @@ import org.aspectj.weaver.tools.Trace; import org.aspectj.weaver.tools.TraceFactory; public class Lint { - Map kinds = new HashMap(); + Map kinds = new HashMap<>(); /* private */World world; public final Kind invalidAbsoluteTypeName = new Kind("invalidAbsoluteTypeName", "no match for this type name: {0}"); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java index 9e608c9ad..86caa48c5 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java @@ -155,7 +155,7 @@ public class MemberImpl implements Member { private static Object[] signatureToTypes(String sig) { boolean hasParameters = sig.charAt(1) != ')'; if (hasParameters) { - List l = new ArrayList(); + List l = new ArrayList<>(); int i = 1; boolean hasAnyAnglies = sig.indexOf('<') != -1; while (true) { @@ -442,7 +442,7 @@ public class MemberImpl implements Member { public Collection getDeclaringTypes(World world) { ResolvedType myType = getDeclaringType().resolve(world); - Collection ret = new HashSet(); + Collection ret = new HashSet<>(); if (kind == CONSTRUCTOR) { // this is wrong if the member doesn't exist, but that doesn't // matter diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java index aad9a1dbe..c40bf9f43 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java @@ -42,7 +42,7 @@ public class ReferenceType extends ResolvedType { * swapped during incremental compilation, the delegate of the derivatives * is swapped also. */ - private final List> derivativeTypes = new ArrayList>(); + private final List> derivativeTypes = new ArrayList<>(); /** * For parameterized types (or the raw type) - this field points to the @@ -62,7 +62,7 @@ public class ReferenceType extends ResolvedType { ResolvedMember[] parameterizedMethods = null; ResolvedMember[] parameterizedFields = null; ResolvedMember[] parameterizedPointcuts = null; - WeakReference parameterizedInterfaces = new WeakReference( + WeakReference parameterizedInterfaces = new WeakReference<>( null); Collection parameterizedDeclares = null; // Collection parameterizedTypeMungers = null; @@ -116,13 +116,13 @@ public class ReferenceType extends ResolvedType { // checkDuplicates(dependent); synchronized (derivativeTypes) { this.derivativeTypes - .add(new WeakReference(dependent)); + .add(new WeakReference<>(dependent)); } } public void checkDuplicates(ReferenceType newRt) { synchronized (derivativeTypes) { - List> forRemoval = new ArrayList>(); + List> forRemoval = new ArrayList<>(); for (WeakReference derivativeTypeReference : derivativeTypes) { ReferenceType derivativeType = derivativeTypeReference.get(); if (derivativeType == null) { @@ -756,7 +756,7 @@ public class ReferenceType extends ResolvedType { interfaces[i] = delegateInterfaces[i]; } } - parameterizedInterfaces = new WeakReference( + parameterizedInterfaces = new WeakReference<>( interfaces); return interfaces; } else if (isRawType()) { @@ -778,12 +778,12 @@ public class ReferenceType extends ResolvedType { .parameterizedWith(toUseForParameterization); } } - parameterizedInterfaces = new WeakReference( + parameterizedInterfaces = new WeakReference<>( interfaces); return interfaces; } if (getDelegate().isCacheable()) { - parameterizedInterfaces = new WeakReference( + parameterizedInterfaces = new WeakReference<>( delegateInterfaces); } return delegateInterfaces; @@ -937,7 +937,7 @@ public class ReferenceType extends ResolvedType { Collection declares = null; if (ajMembersNeedParameterization()) { Collection genericDeclares = getDelegate().getDeclares(); - parameterizedDeclares = new ArrayList(); + parameterizedDeclares = new ArrayList<>(); Map parameterizationMap = getAjMemberParameterizationMap(); for (Declare declareStatement : genericDeclares) { parameterizedDeclares.add(declareStatement.parameterizeWith( @@ -968,7 +968,7 @@ public class ReferenceType extends ResolvedType { return getDelegate().getModifiers(); } - WeakReference superclassReference = new WeakReference( + WeakReference superclassReference = new WeakReference<>( null); @Override @@ -984,7 +984,7 @@ public class ReferenceType extends ResolvedType { getMemberParameterizationMap()).resolve(getWorld()); } if (getDelegate().isCacheable()) { - superclassReference = new WeakReference(ret); + superclassReference = new WeakReference<>(ret); } return newSuperclass; } @@ -999,7 +999,7 @@ public class ReferenceType extends ResolvedType { getWorld()); } if (getDelegate().isCacheable()) { - superclassReference = new WeakReference(ret); + superclassReference = new WeakReference<>(ret); } return ret; } @@ -1019,7 +1019,7 @@ public class ReferenceType extends ResolvedType { } this.delegate = delegate; synchronized (derivativeTypes) { - List> forRemoval = new ArrayList>(); + List> forRemoval = new ArrayList<>(); for (WeakReference derivativeRef : derivativeTypes) { ReferenceType derivative = derivativeRef.get(); if (derivative != null) { @@ -1048,7 +1048,7 @@ public class ReferenceType extends ResolvedType { parameterizedInterfaces.clear(); parameterizedMethods = null; parameterizedPointcuts = null; - superclassReference = new WeakReference(null); + superclassReference = new WeakReference<>(null); } public int getEndPos() { @@ -1171,7 +1171,7 @@ public class ReferenceType extends ResolvedType { newInterfaces = null; typeVariables = null; parameterizedInterfaces.clear(); - superclassReference = new WeakReference(null); + superclassReference = new WeakReference<>(null); if (getDelegate() != null) { delegate.ensureConsistent(); } @@ -1192,7 +1192,7 @@ public class ReferenceType extends ResolvedType { } if (newParent.isClass()) { newSuperclass = newParent; - superclassReference = new WeakReference(null); + superclassReference = new WeakReference<>(null); } else { if (newInterfaces == null) { newInterfaces = new ResolvedType[1]; @@ -1253,7 +1253,7 @@ public class ReferenceType extends ResolvedType { */ public ReferenceType findDerivativeType(ResolvedType[] typeParameters) { synchronized (derivativeTypes) { - List> forRemoval = new ArrayList>(); + List> forRemoval = new ArrayList<>(); for (WeakReference derivativeTypeRef : derivativeTypes) { ReferenceType derivativeType = derivativeTypeRef.get(); if (derivativeType == null) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java index bb609f104..6a12cdd11 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java @@ -123,9 +123,9 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso // } } - List declaringTypes = new ArrayList(); + List declaringTypes = new ArrayList<>(); accumulateTypesInBetween(originalDeclaringType, firstDefiningType, declaringTypes); - Set memberSignatures = new LinkedHashSet(); + Set memberSignatures = new LinkedHashSet<>(); for (ResolvedType declaringType : declaringTypes) { memberSignatures.add(new JoinPointSignature(firstDefiningMember, declaringType)); } @@ -136,7 +136,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso // every type between the firstDefiningMember and the root defining // member. Iterator superTypeIterator = firstDefiningType.getDirectSupertypes(); - List typesAlreadyVisited = new ArrayList(); + List typesAlreadyVisited = new ArrayList<>(); accumulateMembersMatching(firstDefiningMember, superTypeIterator, typesAlreadyVisited, memberSignatures, false); } @@ -188,7 +188,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso ResolvedMemberImpl foundMember = (ResolvedMemberImpl) toLookIn.lookupResolvedMember(memberToMatch, true, ignoreGenerics); if (foundMember != null && isVisibleTo(memberToMatch, foundMember)) { - List declaringTypes = new ArrayList(); + List declaringTypes = new ArrayList<>(); // declaring type can be unresolved if the member can from // an ITD... ResolvedType resolvedDeclaringType = foundMember.getDeclaringType().resolve(toLookIn.getWorld()); @@ -763,7 +763,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso if (isParameterized && (typeVariables.length != typeParameters.length)) { throw new IllegalStateException("Wrong number of type parameters supplied"); } - Map typeMap = new HashMap(); + Map typeMap = new HashMap<>(); boolean typeParametersSupplied = typeParameters != null && typeParameters.length > 0; if (typeVariables != null) { // If no 'replacements' were supplied in the typeParameters array @@ -1058,7 +1058,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso StringBuffer sig = new StringBuffer(); UnresolvedType[] myParameterTypes = getGenericParameterTypes(); for (UnresolvedType myParameterType : myParameterTypes) { - appendSigWithTypeVarBoundsRemoved(myParameterType, sig, new HashSet()); + appendSigWithTypeVarBoundsRemoved(myParameterType, sig, new HashSet<>()); } myParameterSignatureWithBoundsRemoved = sig.toString(); return myParameterSignatureWithBoundsRemoved; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java index 8e48b02d4..3d88279af 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java @@ -156,7 +156,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl // This set contains pairs of types whose signatures are concatenated // together, this means with a fast lookup we can tell if two types // are equivalent. - protected static Set validBoxing = new HashSet(); + protected static Set validBoxing = new HashSet<>(); static { validBoxing.add("Ljava/lang/Byte;B"); @@ -327,7 +327,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl public Iterator getHierarchy(final boolean wantGenerics, final boolean wantDeclaredParents) { final Iterators.Getter interfaceGetter = new Iterators.Getter() { - List alreadySeen = new ArrayList(); // Strings are signatures (ResolvedType.getSignature()) + List alreadySeen = new ArrayList<>(); // Strings are signatures (ResolvedType.getSignature()) @Override public Iterator get(ResolvedType type) { @@ -337,7 +337,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl // relatively expensive but hopefully uncommon if (!wantDeclaredParents && type.hasNewParentMungers()) { // Throw away interfaces from that array if they were decp'd onto here - List forRemoval = new ArrayList(); + List forRemoval = new ArrayList<>(); for (ConcreteTypeMunger munger : type.interTypeMungers) { if (munger.getMunger() != null) { ResolvedTypeMunger m = munger.getMunger(); @@ -391,8 +391,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * declared on the superinterfaces. This is expensive - use the getMethods() method if you can! */ public List getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) { - List methods = new ArrayList(); - Set knowninterfaces = new HashSet(); + List methods = new ArrayList<>(); + Set knowninterfaces = new HashSet<>(); addAndRecurse(knowninterfaces, methods, this, includeITDs, allowMissing, genericsAware); return methods; } @@ -405,8 +405,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * @return list of resolvedtypes in this types hierarchy, including this type first */ public List getHierarchyWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) { - List types = new ArrayList(); - Set visited = new HashSet(); + List types = new ArrayList<>(); + Set visited = new HashSet<>(); recurseHierarchy(visited, types, this, includeITDs, allowMissing, genericsAware); return types; } @@ -554,7 +554,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * process interfaces multiple times. */ public ResolvedMember lookupMethod(Member m) { - List typesTolookat = new ArrayList(); + List typesTolookat = new ArrayList<>(); typesTolookat.add(this); int pos = 0; while (pos < typesTolookat.size()) { @@ -807,7 +807,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return Collections.emptyList(); } - List ret = new ArrayList(); + List ret = new ArrayList<>(); // if (this.isAbstract()) { // for (Iterator i = getDeclares().iterator(); i.hasNext();) { // Declare dec = (Declare) i.next(); @@ -850,7 +850,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return Collections.emptyList(); } - List acc = new ArrayList(); + List acc = new ArrayList<>(); final Iterators.Filter dupFilter = Iterators.dupFilter(); Iterators.Getter typeGetter = new Iterators.Getter() { @Override @@ -987,7 +987,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return Collections.emptyMap(); } TypeVariable[] tvs = getGenericType().getTypeVariables(); - Map parameterizationMap = new HashMap(); + Map parameterizationMap = new HashMap<>(); if (tvs.length != typeParameters.length) { world.getMessageHandler() .handleMessage( @@ -1021,7 +1021,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } public List getDeclaredAdvice() { - List l = new ArrayList(); + List l = new ArrayList<>(); ResolvedMember[] methods = getDeclaredMethods(); if (isParameterizedType()) { methods = getGenericType().getDeclaredMethods(); @@ -1076,7 +1076,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } private ResolvedMember[] filterInJavaVisible(ResolvedMember[] ms) { - List l = new ArrayList(); + List l = new ArrayList<>(); for (ResolvedMember m : ms) { if (!m.isAjSynthetic() && m.getAssociatedShadowMunger() == null) { l.add(m); @@ -1405,14 +1405,14 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return ret; } - protected List interTypeMungers = new ArrayList(); + protected List interTypeMungers = new ArrayList<>(); public List getInterTypeMungers() { return interTypeMungers; } public List getInterTypeParentMungers() { - List l = new ArrayList(); + List l = new ArrayList<>(); for (ConcreteTypeMunger element : interTypeMungers) { if (element.getMunger() instanceof NewParentTypeMunger) { l.add(element); @@ -1425,13 +1425,13 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * ??? This method is O(N*M) where N = number of methods and M is number of inter-type declarations in my super */ public List getInterTypeMungersIncludingSupers() { - ArrayList ret = new ArrayList(); + ArrayList ret = new ArrayList<>(); collectInterTypeMungers(ret); return ret; } public List getInterTypeParentMungersIncludingSupers() { - ArrayList ret = new ArrayList(); + ArrayList ret = new ArrayList<>(); collectInterTypeParentMungers(ret); return ret; } @@ -2311,8 +2311,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl private Getter ifaceGetter; Iterator delegate = null; - public Queue toPersue = new LinkedList(); - public Set visited = new HashSet(); + public Queue toPersue = new LinkedList<>(); + public Set visited = new HashSet<>(); SuperInterfaceWalker(Iterators.Getter ifaceGetter) { this.ifaceGetter = ifaceGetter; @@ -2373,7 +2373,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } // interTypeMungers.clear(); // BUG? Why can't this be clear() instead: 293620 c6 - interTypeMungers = new ArrayList(); + interTypeMungers = new ArrayList<>(); } public boolean isTopmostImplementor(ResolvedType interfaceType) { @@ -2410,7 +2410,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } public List getExposedPointcuts() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); if (getSuperclass() != null) { ret.addAll(getSuperclass().getExposedPointcuts()); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java index 86e06e767..c5b5645fe 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java @@ -168,7 +168,7 @@ public abstract class ResolvedTypeMunger { } protected static Set readSuperMethodsCalled(VersionedDataInputStream s) throws IOException { - Set ret = new HashSet(); + Set ret = new HashSet<>(); int n = -1; if (s.isAtLeast169()) { n = s.readByte(); @@ -189,7 +189,7 @@ public abstract class ResolvedTypeMunger { s.writeByte(0); return; } - List ret = new ArrayList(superMethodsCalled); + List ret = new ArrayList<>(superMethodsCalled); Collections.sort(ret); int n = ret.size(); s.writeByte(n); @@ -378,7 +378,7 @@ public abstract class ResolvedTypeMunger { count = s.readInt(); } if (count != 0) { - List aliases = new ArrayList(); + List aliases = new ArrayList<>(); for (int i = 0; i < count; i++) { aliases.add(s.readUTF()); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java index 1892e8940..b48b87489 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java @@ -533,7 +533,7 @@ public abstract class Shadow { public void addMunger(ShadowMunger munger) { if (checkMunger(munger)) { if (mungers == Collections.EMPTY_LIST) { - mungers = new ArrayList(); + mungers = new ArrayList<>(); } this.mungers.add(munger); } @@ -571,7 +571,7 @@ public abstract class Shadow { // Stores a set of strings of the form 'aspect1:aspect2' which indicates there is no // precedence specified between the two aspects at this shadow. - Set clashingAspects = new HashSet(); + Set clashingAspects = new HashSet<>(); int max = mungers.size(); // Compare every pair of advice mungers @@ -688,7 +688,7 @@ public abstract class Shadow { * manipulation! */ public static Set toSet(int i) { - Set results = new HashSet(); + Set results = new HashSet<>(); for (int j = 0; j < Shadow.SHADOW_KINDS.length; j++) { Kind k = Shadow.SHADOW_KINDS[j]; if (k.isSet(i)) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java index 809cc58de..3a2a3a740 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java @@ -93,7 +93,7 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH + "' due to scope exclusion in XML definition")); } if (excludedTypes == null) { - excludedTypes = new HashSet(); + excludedTypes = new HashSet<>(); excludedTypes.add(type); world.getExclusionMap().put(declaringType, excludedTypes); } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java index 5c898552d..4ec4c14c3 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java @@ -116,7 +116,7 @@ public class StandardAnnotation extends AbstractAnnotationAJ { AnnotationNameValuePair nvp = nvPairs.get(0); ArrayAnnotationValue aav = (ArrayAnnotationValue) nvp.getValue(); AnnotationValue[] avs = aav.getValues(); - Set targets = new HashSet(); + Set targets = new HashSet<>(); for (AnnotationValue av : avs) { EnumAnnotationValue value = (EnumAnnotationValue) av; targets.add(value.getValue()); @@ -134,7 +134,7 @@ public class StandardAnnotation extends AbstractAnnotationAJ { public void addNameValuePair(AnnotationNameValuePair pair) { if (nvPairs == null) { - nvPairs = new ArrayList(); + nvPairs = new ArrayList<>(); } nvPairs.add(pair); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java index 2a578e392..72163e024 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java @@ -289,7 +289,7 @@ public class TypeFactory { private static UnresolvedType[] createTypeParams(String typeParameterSpecification) { String remainingToProcess = typeParameterSpecification; - List types = new ArrayList(); + List types = new ArrayList<>(); while (remainingToProcess.length() != 0) { int endOfSig = 0; int anglies = 0; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeaverStateInfo.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeaverStateInfo.java index f0dcbf270..62158cb9a 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeaverStateInfo.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeaverStateInfo.java @@ -89,7 +89,7 @@ public class WeaverStateInfo { } public WeaverStateInfo(boolean reweavable) { - this(new ArrayList(), false, reweavable, reweavableCompressedModeDefault, reweavableDiffModeDefault); + this(new ArrayList<>(), false, reweavable, reweavableCompressedModeDefault, reweavableDiffModeDefault); } private WeaverStateInfo(List typeMungers, boolean oldStyle, boolean reweavableMode, boolean reweavableCompressedMode, @@ -99,7 +99,7 @@ public class WeaverStateInfo { this.reweavable = reweavableMode; this.reweavableCompressedMode = reweavableCompressedMode; this.reweavableDiffMode = reweavableMode ? reweavableDiffMode : false; - this.aspectsAffectingType = new HashSet(); + this.aspectsAffectingType = new HashSet<>(); this.unwovenClassFile = null; } @@ -147,7 +147,7 @@ public class WeaverStateInfo { } int n = s.readShort(); - List l = new ArrayList(); + List l = new ArrayList<>(); for (int i = 0; i < n; i++) { // conditional on version UnresolvedType aspectType = null; @@ -257,7 +257,7 @@ public class WeaverStateInfo { public List getTypeMungers(ResolvedType onType) { World world = onType.getWorld(); - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (Entry entry : typeMungers) { ResolvedType aspectType = world.resolve(entry.aspectType, true); if (aspectType.isMissing()) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java index b2af422ff..671693e30 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java @@ -378,7 +378,7 @@ public abstract class World implements Dump.INode { // MessageUtil.error(messageHandler, // WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE,ty.getName())); if (dumpState_cantFindTypeExceptions == null) { - dumpState_cantFindTypeExceptions = new ArrayList(); + dumpState_cantFindTypeExceptions = new ArrayList<>(); } if (dumpState_cantFindTypeExceptions.size() < 100) { // limit growth dumpState_cantFindTypeExceptions.add(new RuntimeException("Can't find type " + ty.getName())); @@ -1045,11 +1045,11 @@ public abstract class World implements Dump.INode { public int policy = USE_WEAK_REFS; // Map of types that never get thrown away - final Map tMap = new HashMap(); + final Map tMap = new HashMap<>(); // Map of types that may be ejected from the cache if we need space final Map> expendableMap = Collections - .synchronizedMap(new WeakHashMap>()); + .synchronizedMap(new WeakHashMap<>()); private final World w; @@ -1057,13 +1057,13 @@ public abstract class World implements Dump.INode { private boolean memoryProfiling = false; private int maxExpendableMapSize = -1; private int collectedTypes = 0; - private final ReferenceQueue rq = new ReferenceQueue(); + private final ReferenceQueue rq = new ReferenceQueue<>(); TypeMap(World w) { // Demotion activated when switched on and loadtime weaving or in AJDT demotionSystemActive = w.isDemotionActive() && (w.isLoadtimeWeaving() || w.couldIncrementalCompileFollow()); - addedSinceLastDemote = new ArrayList(); - writtenClasses = new ArrayList(); + addedSinceLastDemote = new ArrayList<>(); + writtenClasses = new ArrayList<>(); this.w = w; memoryProfiling = false;// !w.getMessageHandler().isIgnoring(Message.INFO); } @@ -1115,7 +1115,7 @@ public abstract class World implements Dump.INode { addedSinceLastDemote.clear(); } else { // Compile time demotion strategy - List forRemoval = new ArrayList(); + List forRemoval = new ArrayList<>(); for (String key : addedSinceLastDemote) { ResolvedType type = tMap.get(key); if (type == null) { @@ -1189,9 +1189,9 @@ public abstract class World implements Dump.INode { // might be GC'd independently. expendableMap.remove(key); if (policy == USE_SOFT_REFS) { - expendableMap.put(key, new SoftReference(type)); + expendableMap.put(key, new SoftReference<>(type)); } else { - expendableMap.put(key, new WeakReference(type)); + expendableMap.put(key, new WeakReference<>(type)); } } } @@ -1265,15 +1265,15 @@ public abstract class World implements Dump.INode { // Dont use reference queue for tracking if not profiling... if (policy == USE_WEAK_REFS) { if (memoryProfiling) { - expendableMap.put(key, new WeakReference(type, rq)); + expendableMap.put(key, new WeakReference<>(type, rq)); } else { - expendableMap.put(key, new WeakReference(type)); + expendableMap.put(key, new WeakReference<>(type)); } } else if (policy == USE_SOFT_REFS) { if (memoryProfiling) { - expendableMap.put(key, new SoftReference(type, rq)); + expendableMap.put(key, new SoftReference<>(type, rq)); } else { - expendableMap.put(key, new SoftReference(type)); + expendableMap.put(key, new SoftReference<>(type)); } // } else { // expendableMap.put(key, type); @@ -1418,7 +1418,7 @@ public abstract class World implements Dump.INode { public AspectPrecedenceCalculator(World forSomeWorld) { world = forSomeWorld; - cachedResults = new HashMap(); + cachedResults = new HashMap<>(); } /** @@ -1521,7 +1521,7 @@ public abstract class World implements Dump.INode { // --- I would rather stash this against a reference type - but we don't // guarantee referencetypes are unique for // so we can't :( - private final Map, TypeVariable[]> workInProgress1 = new HashMap, TypeVariable[]>(); + private final Map, TypeVariable[]> workInProgress1 = new HashMap<>(); public TypeVariable[] getTypeVariablesCurrentlyBeingProcessed(Class baseClass) { return workInProgress1.get(baseClass); @@ -1756,7 +1756,7 @@ public abstract class World implements Dump.INode { */ public void registerPointcutHandler(PointcutDesignatorHandler designatorHandler) { if (pointcutDesignators == null) { - pointcutDesignators = new HashSet(); + pointcutDesignators = new HashSet<>(); } pointcutDesignators.add(designatorHandler); } @@ -1841,7 +1841,7 @@ public abstract class World implements Dump.INode { // map from aspect > excluded types // memory issue here? - private Map> exclusionMap = new HashMap>(); + private Map> exclusionMap = new HashMap<>(); public Map> getExclusionMap() { return exclusionMap; @@ -1886,10 +1886,10 @@ public abstract class World implements Dump.INode { long typeCount; long perJoinpointCount; long perTypes; - Map joinpointsPerPointcut = new HashMap(); - Map timePerPointcut = new HashMap(); - Map fastMatchTimesPerPointcut = new HashMap(); - Map fastMatchTypesPerPointcut = new HashMap(); + Map joinpointsPerPointcut = new HashMap<>(); + Map timePerPointcut = new HashMap<>(); + Map fastMatchTimesPerPointcut = new HashMap<>(); + Map fastMatchTypesPerPointcut = new HashMap<>(); TimeCollector(World world) { this.perJoinpointCount = world.timersPerJoinpoint; @@ -1897,8 +1897,8 @@ public abstract class World implements Dump.INode { this.world = world; this.joinpointCount = 0; this.typeCount = 0; - this.joinpointsPerPointcut = new HashMap(); - this.timePerPointcut = new HashMap(); + this.joinpointsPerPointcut = new HashMap<>(); + this.timePerPointcut = new HashMap<>(); } public void report() { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndSignaturePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndSignaturePattern.java index c05995377..b374eea5a 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndSignaturePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndSignaturePattern.java @@ -46,7 +46,7 @@ public class AndSignaturePattern extends AbstractSignaturePattern { public List getExactDeclaringTypes() { if (exactDeclaringTypes == null) { - exactDeclaringTypes = new ArrayList(); + exactDeclaringTypes = new ArrayList<>(); exactDeclaringTypes.addAll(leftSp.getExactDeclaringTypes()); exactDeclaringTypes.addAll(rightSp.getExactDeclaringTypes()); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java index 2f70523cd..7f7abd1e9 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java @@ -263,7 +263,7 @@ public class AnnotationPointcut extends NameBindingPointcut { @Override public List getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingPattern) { // BindingAnnotationTypePattern) { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add((BindingPattern)annotationTypePattern); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java index f7351b5d7..349ebef79 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java @@ -180,7 +180,7 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut { } public List getBindingAnnotationTypePatterns() { - List l = new ArrayList(); + List l = new ArrayList<>(); AnnotationTypePattern[] pats = arguments.getAnnotationPatterns(); for (AnnotationTypePattern pat : pats) { if (pat instanceof BindingAnnotationTypePattern) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java index 98c78d54d..0522bb13c 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java @@ -122,7 +122,7 @@ public class ArgsPointcut extends NameBindingPointcut { } public List getBindingTypePatterns() { - List l = new ArrayList(); + List l = new ArrayList<>(); TypePattern[] pats = arguments.getTypePatterns(); for (TypePattern pat : pats) { if (pat instanceof BindingTypePattern) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java index 0a099529b..ef537d807 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java @@ -84,7 +84,7 @@ public class BasicTokenSource implements ITokenSource { char[] chars = input.toCharArray(); int i = 0; - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); while (i < chars.length) { char ch = chars[i++]; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/CflowPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/CflowPointcut.java index a83236e5c..b283a845f 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/CflowPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/CflowPointcut.java @@ -194,7 +194,7 @@ public class CflowPointcut extends Pointcut { entryBindings.popEnclosingDefinitition(); } - List innerCflowEntries = new ArrayList(xcut.getCflowEntries()); + List innerCflowEntries = new ArrayList<>(xcut.getCflowEntries()); innerCflowEntries.removeAll(previousCflowEntries); // Four routes of interest through this code (did I hear someone say @@ -248,7 +248,7 @@ public class CflowPointcut extends Pointcut { return ret; } else { - List slots = new ArrayList(); + List slots = new ArrayList<>(); for (int i = 0, len = freeVars.length; i < len; i++) { int freeVar = freeVars[i]; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java index ba1d29415..8f7b26648 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java @@ -77,9 +77,9 @@ public class DeclareAnnotation extends Declare { } private void init() { - this.annotationMethods = new ArrayList(); + this.annotationMethods = new ArrayList<>(); annotationMethods.add("unknown"); - this.annotationStrings = new ArrayList(); + this.annotationStrings = new ArrayList<>(); annotationStrings.add("@"); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareParents.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareParents.java index 53553afb3..440a9ce5d 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareParents.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareParents.java @@ -342,7 +342,7 @@ public class DeclareParents extends Declare { return Collections.emptyList(); } - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (int i = 0; i < parents.size(); i++) { ResolvedType t = maybeGetNewParent(onType, parents.get(i), onType.getWorld(), reportErrors); if (t != null) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java index 8105a4f1d..6903b9b83 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java @@ -411,7 +411,7 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern { if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160M2) { int annotationValueCount = s.readInt(); if (annotationValueCount > 0) { - Map aValues = new HashMap(); + Map aValues = new HashMap<>(); for (int i = 0; i < annotationValueCount; i++) { String key = s.readUTF(); String val = s.readUTF(); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java index d54ad29ab..b439de277 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java @@ -40,7 +40,7 @@ public class ExactTypePattern extends TypePattern { private static final Map> boxedTypesMap; static { - primitiveTypesMap = new HashMap>(); + primitiveTypesMap = new HashMap<>(); primitiveTypesMap.put("int", int.class); primitiveTypesMap.put("short", short.class); primitiveTypesMap.put("long", long.class); @@ -49,7 +49,7 @@ public class ExactTypePattern extends TypePattern { primitiveTypesMap.put("float", float.class); primitiveTypesMap.put("double", double.class); - boxedPrimitivesMap = new HashMap>(); + boxedPrimitivesMap = new HashMap<>(); boxedPrimitivesMap.put("java.lang.Integer", Integer.class); boxedPrimitivesMap.put("java.lang.Short", Short.class); boxedPrimitivesMap.put("java.lang.Long", Long.class); @@ -58,7 +58,7 @@ public class ExactTypePattern extends TypePattern { boxedPrimitivesMap.put("java.lang.Float", Float.class); boxedPrimitivesMap.put("java.lang.Double", Double.class); - boxedTypesMap = new HashMap>(); + boxedTypesMap = new HashMap<>(); boxedTypesMap.put("int", Integer.class); boxedTypesMap.put("short", Short.class); boxedTypesMap.put("long", Long.class); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java index a845153f9..8c2cb36b9 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java @@ -191,7 +191,7 @@ public class IfPointcut extends Pointcut { } Test ret = Literal.TRUE; - List args = new ArrayList(); + List args = new ArrayList<>(); // code style if (extraParameterFlags >= 0) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java index d4b747af3..259edfab1 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java @@ -29,7 +29,7 @@ public class ModifiersPattern extends PatternNode { private static Map modifierFlags = null; static { - modifierFlags = new HashMap(); + modifierFlags = new HashMap<>(); int flag = 1; while (flag <= Modifier.STRICT) { String flagName = Modifier.toString(flag); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrSignaturePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrSignaturePattern.java index 67346f444..13244f70e 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrSignaturePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrSignaturePattern.java @@ -46,7 +46,7 @@ public class OrSignaturePattern extends AbstractSignaturePattern { public List getExactDeclaringTypes() { if (exactDeclaringTypes == null) { - exactDeclaringTypes = new ArrayList(); + exactDeclaringTypes = new ArrayList<>(); exactDeclaringTypes.addAll(leftSp.getExactDeclaringTypes()); exactDeclaringTypes.addAll(rightSp.getExactDeclaringTypes()); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PatternParser.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PatternParser.java index effecfeaf..c329ba88e 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PatternParser.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PatternParser.java @@ -259,7 +259,7 @@ public class PatternParser { } public DeclarePrecedence parseDominates() { - List l = new ArrayList(); + List l = new ArrayList<>(); do { l.add(parseTypePattern()); } while (maybeEat(",")); @@ -282,7 +282,7 @@ public class PatternParser { } boolean isExtends = t.getString().equals("extends"); - List l = new ArrayList(); + List l = new ArrayList<>(); do { l.add(parseTypePattern()); } while (maybeEat(",")); @@ -679,7 +679,7 @@ public class PatternParser { } public List parseDottedIdentifier() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); ret.add(parseIdentifier()); while (maybeEat(".")) { ret.add(parseIdentifier()); @@ -915,7 +915,7 @@ public class PatternParser { // Parse annotation values. In an expression in @A(a=b,c=d) this method will be // parsing the a=b,c=d.) public Map parseAnnotationValues() { - Map values = new HashMap(); + Map values = new HashMap<>(); boolean seenDefaultValue = false; do { String possibleKeyString = parseAnnotationNameValuePattern(); @@ -1133,7 +1133,7 @@ public class PatternParser { } public TypePattern parseGenericsWildcardTypePattern() { - List names = new ArrayList(); + List names = new ArrayList<>(); names.add(new NamePattern("?")); TypePattern upperBound = null; TypePattern[] additionalInterfaceBounds = new TypePattern[0]; @@ -1242,7 +1242,7 @@ public class PatternParser { // } public List parseDottedNamePattern() { - List names = new ArrayList(); + List names = new ArrayList<>(); StringBuffer buf = new StringBuffer(); IToken previous = null; boolean justProcessedEllipsis = false; // Remember if we just dealt with an ellipsis (PR61536) @@ -1464,7 +1464,7 @@ public class PatternParser { } public TypePatternList parseArgumentsPattern(boolean parameterAnnotationsPossible) { - List patterns = new ArrayList(); + List patterns = new ArrayList<>(); eat("("); // () @@ -1485,7 +1485,7 @@ public class PatternParser { } public AnnotationPatternList parseArgumentsAnnotationPattern() { - List patterns = new ArrayList(); + List patterns = new ArrayList<>(); eat("("); if (maybeEat(")")) { return new AnnotationPatternList(); @@ -1509,8 +1509,8 @@ public class PatternParser { IToken t = tokenSource.peek(); if (t.isIdentifier() && t.getString().equals("throws")) { tokenSource.next(); - List required = new ArrayList(); - List forbidden = new ArrayList(); + List required = new ArrayList<>(); + List forbidden = new ArrayList<>(); do { boolean isForbidden = maybeEat("!"); // ???might want an error for a second ! without a paren @@ -1694,7 +1694,7 @@ public class PatternParser { if (!maybeEat("<")) { return null; } - List typeVars = new ArrayList(); + List typeVars = new ArrayList<>(); TypeVariablePattern t = parseTypeVariable(); typeVars.add(t); while (maybeEat(",")) { @@ -1712,7 +1712,7 @@ public class PatternParser { if (!maybeEat("<")) { return null; } - List typeVarNames = new ArrayList(); + List typeVarNames = new ArrayList<>(); do { typeVarNames.add(parseIdentifier()); } while (maybeEat(",")); @@ -1726,7 +1726,7 @@ public class PatternParser { if (!maybeEat("<")) { return null; } - List typePats = new ArrayList(); + List typePats = new ArrayList<>(); do { TypePattern tp = parseTypePattern(true, false); typePats.add(tp); @@ -1752,7 +1752,7 @@ public class PatternParser { } private TypePattern[] maybeParseAdditionalInterfaceBounds() { - List boundsList = new ArrayList(); + List boundsList = new ArrayList<>(); while (maybeEat("&")) { TypePattern tp = parseTypePattern(); boundsList.add(tp); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PerCflow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PerCflow.java index 1ad834e06..31975df77 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PerCflow.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PerCflow.java @@ -101,7 +101,7 @@ public class PerCflow extends PerClause { // EMPTY // ) // ; - List innerCflowEntries = new ArrayList(xcut.getCflowEntries()); + List innerCflowEntries = new ArrayList<>(xcut.getCflowEntries()); innerCflowEntries.removeAll(previousCflowEntries); xcut.addConcreteShadowMunger(Advice.makePerCflowEntry(world, concreteEntry, isBelow, cflowStackField, inAspect, diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java index 72e552ab4..4e1ef74df 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java @@ -327,7 +327,7 @@ public class PointcutRewriter { } private Pointcut simplifyAnd(AndPointcut apc) { - SortedSet nodes = new TreeSet(new PointcutEvaluationExpenseComparator()); + SortedSet nodes = new TreeSet<>(new PointcutEvaluationExpenseComparator()); collectAndNodes(apc, nodes); // look for A and !A, or IfFalse for (Pointcut element : nodes) { @@ -361,7 +361,7 @@ public class PointcutRewriter { } private Pointcut sortOrs(Pointcut pc) { - SortedSet nodes = new TreeSet(new PointcutEvaluationExpenseComparator()); + SortedSet nodes = new TreeSet<>(new PointcutEvaluationExpenseComparator()); collectOrNodes(pc, nodes); // write out with cheapest on left Iterator iter = nodes.iterator(); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ReferencePointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ReferencePointcut.java index 6e74a1a2f..6a234d04c 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ReferencePointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ReferencePointcut.java @@ -197,7 +197,7 @@ public class ReferencePointcut extends Pointcut { if (onType.isParameterizedType()) { // build a type map mapping type variable names in the generic type to // the type parameters presented - typeVariableMap = new HashMap(); + typeVariableMap = new HashMap<>(); ResolvedType underlyingGenericType = ((ResolvedType) onType).getGenericType(); TypeVariable[] tVars = underlyingGenericType.getTypeVariables(); ResolvedType[] typeParams = ((ResolvedType) onType).getResolvedTypeParameters(); @@ -344,7 +344,7 @@ public class ReferencePointcut extends Pointcut { if (searchStart.isParameterizedType()) { // build a type map mapping type variable names in the generic type to // the type parameters presented - typeVariableMap = new HashMap(); + typeVariableMap = new HashMap<>(); ResolvedType underlyingGenericType = searchStart.getGenericType(); TypeVariable[] tVars = underlyingGenericType.getTypeVariables(); ResolvedType[] typeParams = searchStart.getResolvedTypeParameters(); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java index 4541d1579..e1a52f8c8 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java @@ -174,7 +174,7 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern { private class TypePatternVisitor extends AbstractPatternNodeVisitor { private IScope scope; - private Map incorrectTargetKinds = new HashMap(); + private Map incorrectTargetKinds = new HashMap<>(); private boolean targetsOtherThanTypeAllowed; private boolean parameterTargettingAnnotationsAllowed; @@ -206,7 +206,7 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern { if (targetKinds == null) { return data; } - List incorrectTargets = new ArrayList(); + List incorrectTargets = new ArrayList<>(); for (AnnotationTargetKind targetKind : targetKinds) { if (targetKind.getName().equals(kind.getName()) || (targetKind.getName().equals("PARAMETER") && node.isForParameterAnnotationMatch())) { @@ -990,7 +990,7 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern { @Override public List getExactDeclaringTypes() { if (declaringType instanceof ExactTypePattern) { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add((ExactTypePattern) declaringType); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java index dfb509195..17b511f71 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java @@ -248,7 +248,7 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut { @Override public List getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add((BindingPattern)annotationTypePattern); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java index a278e76c6..b4950975f 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java @@ -165,7 +165,7 @@ public class ThisOrTargetPointcut extends NameBindingPointcut { @Override public List getBindingTypePatterns() { if (typePattern instanceof BindingTypePattern) { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add((BindingTypePattern)typePattern); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java index 040d6dbe2..2b17520a2 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java @@ -531,7 +531,7 @@ public class TypePatternList extends PatternNode { } public List getExactTypes() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (TypePattern typePattern : typePatterns) { UnresolvedType t = typePattern.getExactType(); if (!ResolvedType.isMissing(t)) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java index 8289d306e..162665c2c 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java @@ -22,7 +22,7 @@ import org.aspectj.weaver.ResolvedType; public class TypePatternQuestions { - private Map questionsAndAnswers = new HashMap(); + private Map questionsAndAnswers = new HashMap<>(); public FuzzyBoolean askQuestion(TypePattern pattern, ResolvedType type, TypePattern.MatchKind kind) diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java index 531b3d09f..dd95d4c77 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java @@ -82,7 +82,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern { // - the value names are for valid annotation fields // - the specified values are of the correct type // - for enums, check the specified values can be resolved in the specified scope - Map replacementValues = new HashMap(); + Map replacementValues = new HashMap<>(); Set keys = annotationValues.keySet(); ResolvedMember[] ms = annotationType.getDeclaredMethods(); for (String k: keys) { @@ -391,7 +391,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern { if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160M2) { int annotationValueCount = s.readInt(); if (annotationValueCount > 0) { - Map aValues = new HashMap(); + Map aValues = new HashMap<>(); for (int i = 0; i < annotationValueCount; i++) { String key = s.readUTF(); String val = s.readUTF(); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java index c766d30ba..b8e58c342 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java @@ -199,7 +199,7 @@ public class WildTypePattern extends TypePattern { // part of the declared type name (generated code often uses $s in type // names). More work required on our part to get this right... public static char[][] splitNames(String s, boolean convertDollar) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); int startIndex = 0; while (true) { int breakIndex = s.indexOf('.', startIndex); // what about / @@ -387,7 +387,7 @@ public class WildTypePattern extends TypePattern { private boolean innerMatchesExactly(String s, boolean isAnonymous, boolean convertDollar /* isNested */) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); int startIndex = 0; while (true) { int breakIndex = s.indexOf('.', startIndex); // what about / @@ -1157,7 +1157,7 @@ public class WildTypePattern extends TypePattern { private String[] preMatch(String[] possibleMatches) { // if (namePatterns.length != 1) return CollectionUtil.NO_STRINGS; - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (String possibleMatch : possibleMatches) { char[][] names = splitNames(possibleMatch, true); // ??? not most efficient if (namePatterns[0].matches(names[names.length - 1])) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java index 42ec11dc2..777191f88 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java @@ -164,7 +164,7 @@ public class WithinAnnotationPointcut extends NameBindingPointcut { @Override public List getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add((BindingPattern)annotationTypePattern); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java index 408c829f5..69cc9b7ac 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java @@ -172,7 +172,7 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut { public List getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add((BindingPattern)annotationTypePattern); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java index c784ff288..c4bcb3665 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java @@ -35,12 +35,12 @@ import org.aspectj.weaver.World; */ public class ReflectionWorld extends World implements IReflectionWorld { - private static Map rworlds = Collections.synchronizedMap(new HashMap()); + private static Map rworlds = Collections.synchronizedMap(new HashMap<>()); private WeakClassLoaderReference classLoaderReference; private AnnotationFinder annotationFinder; private boolean mustUseOneFourDelegates = false; // for testing - private Map> inProgressResolutionClasses = new HashMap>(); + private Map> inProgressResolutionClasses = new HashMap<>(); public static ReflectionWorld getReflectionWorldFor(WeakClassLoaderReference classLoaderReference) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/PointcutParser.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/PointcutParser.java index ca0fa3aca..5c4a4d27d 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/PointcutParser.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/PointcutParser.java @@ -60,14 +60,14 @@ public class PointcutParser { private ReflectionWorld world; private WeakClassLoaderReference classLoaderReference; private final Set supportedPrimitives; - private final Set pointcutDesignators = new HashSet(); + private final Set pointcutDesignators = new HashSet<>(); /** * @return a Set containing every PointcutPrimitive except if, cflow, and cflowbelow (useful for passing to PointcutParser * constructor). */ public static Set getAllSupportedPointcutPrimitives() { - Set primitives = new HashSet(); + Set primitives = new HashSet<>(); primitives.add(PointcutPrimitive.ADVICE_EXECUTION); primitives.add(PointcutPrimitive.ARGS); primitives.add(PointcutPrimitive.CALL); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java index afc14188d..65de08759 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java @@ -53,14 +53,14 @@ public class StandardPointcutParser { private World world; private final Set supportedPrimitives; - private final Set pointcutDesignators = new HashSet(); + private final Set pointcutDesignators = new HashSet<>(); /** * @return a Set containing every PointcutPrimitive except if, cflow, and cflowbelow (useful for passing to PointcutParser * constructor). */ public static Set getAllSupportedPointcutPrimitives() { - Set primitives = new HashSet(); + Set primitives = new HashSet<>(); primitives.add(PointcutPrimitive.ADVICE_EXECUTION); primitives.add(PointcutPrimitive.ARGS); primitives.add(PointcutPrimitive.CALL); diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/CommonWorldTests.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/CommonWorldTests.java index 8998904a6..9389fff8b 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/CommonWorldTests.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/CommonWorldTests.java @@ -92,10 +92,10 @@ public abstract class CommonWorldTests extends TestCase { ResolvedType ty = world.resolve(tx, true); assertTrue("Couldnt find type " + tx, !ty.isMissing()); ResolvedType[] lowerTyArray = world.resolve(UnresolvedType.forSignatures(lowers)); - List lowerTys = new ArrayList(Arrays.asList(lowerTyArray)); + List lowerTys = new ArrayList<>(Arrays.asList(lowerTyArray)); lowerTys.add(ty); - Set allLowerTys = new HashSet(lowerTys); - Set allUpperTys = new HashSet(Arrays.asList(primitives)); + Set allLowerTys = new HashSet<>(lowerTys); + Set allUpperTys = new HashSet<>(Arrays.asList(primitives)); allUpperTys.removeAll(allLowerTys); for (ResolvedType other : allLowerTys) { diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/TestUtils.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/TestUtils.java index ac4c46cb7..9f7daa756 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/TestUtils.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/TestUtils.java @@ -287,7 +287,7 @@ public class TestUtils { public static String[] parseIds(String str) { if (str.length() == 0) return ZERO_STRINGS; - List l = new ArrayList(); + List l = new ArrayList<>(); int start = 0; while (true) { int i = str.indexOf(',', start); diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ConstantPoolSimulator.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ConstantPoolSimulator.java index 57f971665..1583900f4 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ConstantPoolSimulator.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ConstantPoolSimulator.java @@ -17,7 +17,7 @@ import org.aspectj.weaver.ConstantPoolReader; import org.aspectj.weaver.ConstantPoolWriter; public class ConstantPoolSimulator implements ConstantPoolWriter, ConstantPoolReader { - List list = new ArrayList(); + List list = new ArrayList<>(); public int writeUtf8(String string) { int i = list.indexOf(string); diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java index 7ffad81d5..9f524d836 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java @@ -700,7 +700,7 @@ public class ParserTestCase extends PatternsTestCase { WildAnnotationTypePattern watp = (WildAnnotationTypePattern) atp; Map m = watp.annotationValues; Set keys = m.keySet(); - List orderedKeys = new ArrayList(); + List orderedKeys = new ArrayList<>(); orderedKeys.addAll(keys); Collections.sort(orderedKeys); StringBuffer sb = new StringBuffer(); diff --git a/runtime/src/main/java/org/aspectj/internal/lang/reflect/AjTypeImpl.java b/runtime/src/main/java/org/aspectj/internal/lang/reflect/AjTypeImpl.java index 542aeb182..2aacae7bf 100644 --- a/runtime/src/main/java/org/aspectj/internal/lang/reflect/AjTypeImpl.java +++ b/runtime/src/main/java/org/aspectj/internal/lang/reflect/AjTypeImpl.java @@ -270,7 +270,7 @@ public class AjTypeImpl implements AjType { */ public Field[] getDeclaredFields() { Field[] fields = clazz.getDeclaredFields(); - List filteredFields = new ArrayList(); + List filteredFields = new ArrayList<>(); for (Field field : fields) if (!field.getName().startsWith(ajcMagic) && !field.isAnnotationPresent(DeclareWarning.class) @@ -296,7 +296,7 @@ public class AjTypeImpl implements AjType { */ public Field[] getFields() { Field[] fields = clazz.getFields(); - List filteredFields = new ArrayList(); + List filteredFields = new ArrayList<>(); for (Field field : fields) if (!field.getName().startsWith(ajcMagic) && !field.isAnnotationPresent(DeclareWarning.class) @@ -331,7 +331,7 @@ public class AjTypeImpl implements AjType { */ public Method[] getDeclaredMethods() { Method[] methods = clazz.getDeclaredMethods(); - List filteredMethods = new ArrayList(); + List filteredMethods = new ArrayList<>(); for (Method method : methods) { if (isReallyAMethod(method)) filteredMethods.add(method); } @@ -345,7 +345,7 @@ public class AjTypeImpl implements AjType { */ public Method[] getMethods() { Method[] methods = clazz.getMethods(); - List filteredMethods = new ArrayList(); + List filteredMethods = new ArrayList<>(); for (Method method : methods) { if (isReallyAMethod(method)) filteredMethods.add(method); } @@ -391,7 +391,7 @@ public class AjTypeImpl implements AjType { */ public Pointcut[] getDeclaredPointcuts() { if (declaredPointcuts != null) return declaredPointcuts; - List pointcuts = new ArrayList(); + List pointcuts = new ArrayList<>(); Method[] methods = clazz.getDeclaredMethods(); for (Method method : methods) { Pointcut pc = asPointcut(method); @@ -408,7 +408,7 @@ public class AjTypeImpl implements AjType { */ public Pointcut[] getPointcuts() { if (pointcuts != null) return pointcuts; - List pcuts = new ArrayList(); + List pcuts = new ArrayList<>(); Method[] methods = clazz.getMethods(); for (Method method : methods) { Pointcut pc = asPointcut(method); @@ -465,7 +465,7 @@ public class AjTypeImpl implements AjType { */ private Advice[] getDeclaredAdvice(Set ofAdviceTypes) { if (declaredAdvice == null) initDeclaredAdvice(); - List adviceList = new ArrayList(); + List adviceList = new ArrayList<>(); for (Advice a : declaredAdvice) { if (ofAdviceTypes.contains(a.getKind())) adviceList.add(a); } @@ -476,7 +476,7 @@ public class AjTypeImpl implements AjType { private void initDeclaredAdvice() { Method[] methods = clazz.getDeclaredMethods(); - List adviceList = new ArrayList(); + List adviceList = new ArrayList<>(); for (Method method : methods) { Advice advice = asAdvice(method); if (advice != null) adviceList.add(advice); @@ -490,7 +490,7 @@ public class AjTypeImpl implements AjType { */ private Advice[] getAdvice(Set ofAdviceTypes) { if (advice == null) initAdvice(); - List adviceList = new ArrayList(); + List adviceList = new ArrayList<>(); for (Advice a : advice) { if (ofAdviceTypes.contains(a.getKind())) adviceList.add(a); } @@ -501,7 +501,7 @@ public class AjTypeImpl implements AjType { private void initAdvice() { Method[] methods = clazz.getMethods(); - List adviceList = new ArrayList(); + List adviceList = new ArrayList<>(); for (Method method : methods) { Advice advice = asAdvice(method); if (advice != null) adviceList.add(advice); @@ -584,7 +584,7 @@ public class AjTypeImpl implements AjType { */ public InterTypeMethodDeclaration[] getDeclaredITDMethods() { if (this.declaredITDMethods == null) { - List itdms = new ArrayList(); + List itdms = new ArrayList<>(); Method[] baseMethods = clazz.getDeclaredMethods(); for (Method m : baseMethods) { if (!m.getName().contains("ajc$interMethodDispatch1$")) continue; @@ -631,7 +631,7 @@ public class AjTypeImpl implements AjType { public InterTypeMethodDeclaration[] getITDMethods() { if (this.itdMethods == null) { - List itdms = new ArrayList(); + List itdms = new ArrayList<>(); Method[] baseMethods = clazz.getDeclaredMethods(); for (Method m : baseMethods) { if (!m.getName().contains("ajc$interMethod$")) continue; @@ -704,7 +704,7 @@ public class AjTypeImpl implements AjType { public InterTypeConstructorDeclaration[] getDeclaredITDConstructors() { if (this.declaredITDCons == null) { - List itdcs = new ArrayList(); + List itdcs = new ArrayList<>(); Method[] baseMethods = clazz.getDeclaredMethods(); for (Method m : baseMethods) { if (!m.getName().contains("ajc$postInterConstructor")) continue; @@ -746,7 +746,7 @@ public class AjTypeImpl implements AjType { public InterTypeConstructorDeclaration[] getITDConstructors() { if (this.itdCons == null) { - List itdcs = new ArrayList(); + List itdcs = new ArrayList<>(); Method[] baseMethods = clazz.getMethods(); for (Method m : baseMethods) { if (!m.getName().contains("ajc$postInterConstructor")) continue; @@ -780,7 +780,7 @@ public class AjTypeImpl implements AjType { } public InterTypeFieldDeclaration[] getDeclaredITDFields() { - List itdfs = new ArrayList(); + List itdfs = new ArrayList<>(); if (this.declaredITDFields == null) { Method[] baseMethods = clazz.getDeclaredMethods(); for(Method m : baseMethods) { @@ -826,7 +826,7 @@ public class AjTypeImpl implements AjType { } public InterTypeFieldDeclaration[] getITDFields() { - List itdfs = new ArrayList(); + List itdfs = new ArrayList<>(); if (this.itdFields == null) { Method[] baseMethods = clazz.getMethods(); for(Method m : baseMethods) { @@ -857,7 +857,7 @@ public class AjTypeImpl implements AjType { } public DeclareErrorOrWarning[] getDeclareErrorOrWarnings() { - List deows = new ArrayList(); + List deows = new ArrayList<>(); for (Field field : clazz.getDeclaredFields()) { try { if (field.isAnnotationPresent(DeclareWarning.class)) { @@ -894,7 +894,7 @@ public class AjTypeImpl implements AjType { } public DeclareParents[] getDeclareParents() { - List decps = new ArrayList(); + List decps = new ArrayList<>(); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(ajcDeclareParents.class)) { ajcDeclareParents decPAnn = method.getAnnotation(ajcDeclareParents.class); @@ -934,7 +934,7 @@ public class AjTypeImpl implements AjType { } public DeclareSoft[] getDeclareSofts() { - List decs = new ArrayList(); + List decs = new ArrayList<>(); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(ajcDeclareSoft.class)) { ajcDeclareSoft decSAnn = method.getAnnotation(ajcDeclareSoft.class); @@ -955,7 +955,7 @@ public class AjTypeImpl implements AjType { } public DeclareAnnotation[] getDeclareAnnotations() { - List decAs = new ArrayList(); + List decAs = new ArrayList<>(); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(ajcDeclareAnnotation.class)) { ajcDeclareAnnotation decAnn = method.getAnnotation(ajcDeclareAnnotation.class); @@ -988,7 +988,7 @@ public class AjTypeImpl implements AjType { } public DeclarePrecedence[] getDeclarePrecedence() { - List decps = new ArrayList(); + List decps = new ArrayList<>(); // @AspectJ Style if (clazz.isAnnotationPresent(org.aspectj.lang.annotation.DeclarePrecedence.class)) { diff --git a/runtime/src/main/java/org/aspectj/lang/reflect/AjTypeSystem.java b/runtime/src/main/java/org/aspectj/lang/reflect/AjTypeSystem.java index 6e525dc0b..2f21ba2ff 100644 --- a/runtime/src/main/java/org/aspectj/lang/reflect/AjTypeSystem.java +++ b/runtime/src/main/java/org/aspectj/lang/reflect/AjTypeSystem.java @@ -26,7 +26,7 @@ import org.aspectj.internal.lang.reflect.AjTypeImpl; public class AjTypeSystem { private static Map> ajTypes = - Collections.synchronizedMap(new WeakHashMap>()); + Collections.synchronizedMap(new WeakHashMap<>()); /** * Return the AspectJ runtime type representation of the given Java type. @@ -45,14 +45,14 @@ public class AjTypeSystem { if (theAjType != null) { return theAjType; } else { - theAjType = new AjTypeImpl(fromClass); - ajTypes.put(fromClass, new WeakReference(theAjType)); + theAjType = new AjTypeImpl<>(fromClass); + ajTypes.put(fromClass, new WeakReference<>(theAjType)); return theAjType; } } // neither key nor value was found - AjType theAjType = new AjTypeImpl(fromClass); - ajTypes.put(fromClass, new WeakReference(theAjType)); + AjType theAjType = new AjTypeImpl<>(fromClass); + ajTypes.put(fromClass, new WeakReference<>(theAjType)); return theAjType; } } diff --git a/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java b/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java index 0263ee841..2183a5706 100644 --- a/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java +++ b/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java @@ -149,7 +149,7 @@ class JoinPointImpl implements ProceedingJoinPoint { public void stack$AroundClosure(AroundClosure arc) { // If input parameter arc is null this is the 'unlink' call from AroundClosure if (arcs == null) { - arcs = new Stack(); + arcs = new Stack<>(); } if (arc==null) { this.arcs.pop(); diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java index 8a7c8a511..83dcd9911 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java @@ -719,7 +719,7 @@ public class AjcTask extends MatchingTask { public CompilerArg createCompilerarg() { CompilerArg compilerArg = new CompilerArg(); if (compilerArgs == null) { - compilerArgs = new ArrayList(); + compilerArgs = new ArrayList<>(); } compilerArgs.add(compilerArg); return compilerArg; diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java index 194efaf22..8343027a7 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java @@ -74,7 +74,7 @@ public class Ajdoc extends MatchingTask { private boolean fork; private String source; private Html bottom; - private Vector fileSets = new Vector(); + private Vector fileSets = new Vector<>(); /** reset all to initial values - permit gc if Ajdoc is held */ public Ajdoc() { reset(); @@ -94,8 +94,8 @@ public class Ajdoc extends MatchingTask { internalclasspath = null; argfiles = null; docletpath = null; - links = new ArrayList(); - groups = new ArrayList(); + links = new ArrayList<>(); + groups = new ArrayList<>(); doclet = null; failonerror = false; fork = false; @@ -165,7 +165,7 @@ public class Ajdoc extends MatchingTask { private void addFileSets() { if(sourcefiles == null) - sourcefiles = new ArrayList(); + sourcefiles = new ArrayList<>(); Enumeration e = fileSets.elements(); while (e.hasMoreElements()) { @@ -186,7 +186,7 @@ public class Ajdoc extends MatchingTask { public void setPackagenames(String list) { (packagenames == null ? - packagenames = new ArrayList() : + packagenames = new ArrayList<>() : packagenames).addAll(strings(list, true)); } @@ -264,7 +264,7 @@ public class Ajdoc extends MatchingTask { public List createArgfiles() { return (argfiles == null ? - argfiles = new ArrayList() : + argfiles = new ArrayList<>() : argfiles); } @@ -480,7 +480,7 @@ public class Ajdoc extends MatchingTask { public class Doclet { protected String name; protected Path path; - protected List params = new ArrayList(); + protected List params = new ArrayList<>(); public Doclet() {} public void setName(String name) { this.name = name; @@ -617,7 +617,7 @@ public class Ajdoc extends MatchingTask { } } } - Map> groupMap = new HashMap>(); + Map> groupMap = new HashMap<>(); for (Group group: groups) { if (group.title == null) { throw new BuildException("Group names cannot be null!", @@ -629,7 +629,7 @@ public class Ajdoc extends MatchingTask { } List packages = groupMap.get(group.title); if (packages == null) { - packages = new ArrayList(); + packages = new ArrayList<>(); } packages.addAll(group.packages); groupMap.put(group.title, packages); @@ -719,7 +719,7 @@ public class Ajdoc extends MatchingTask { protected final List list(String str, Mapper mapper) { if (str == null) return Collections.emptyList(); - List list = new ArrayList(); + List list = new ArrayList<>(); for (StringTokenizer t = new StringTokenizer(str, ",", false); t.hasMoreTokens();) { list.add(mapper.map(t.nextToken().trim())); diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java index 2516a2ac5..022dcae22 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java @@ -53,7 +53,7 @@ public class Ajc extends DefaultCompilerAdapter { "-encoding", "-target" }); private static List finalList(String[] args) { - List result = new ArrayList(); + List result = new ArrayList<>(); result.addAll(Arrays.asList(args)); return Collections.unmodifiableList(result); } diff --git a/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java b/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java index bbe264846..546eadba3 100644 --- a/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java +++ b/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java @@ -1616,7 +1616,7 @@ public class Ajctest extends Task implements PropertyChangeListener { private List> combinations(List arglist) { List> result = new Vector<>(); - result.add(new Vector()); + result.add(new Vector<>()); for (Argument arg : arglist) { int N = result.size(); for (int i = 0; i < N; i++) { diff --git a/testing/src/test/java/org/aspectj/testing/AjcTest.java b/testing/src/test/java/org/aspectj/testing/AjcTest.java index df460aea1..e8098ed09 100644 --- a/testing/src/test/java/org/aspectj/testing/AjcTest.java +++ b/testing/src/test/java/org/aspectj/testing/AjcTest.java @@ -47,7 +47,7 @@ public class AjcTest { is14VMOrGreater = LangUtil.is14VMOrGreater(); } - private List testSteps = new ArrayList(); + private List testSteps = new ArrayList<>(); private String dir; private String pr; diff --git a/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java b/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java index 966166c33..2b7e4942f 100644 --- a/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java +++ b/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java @@ -35,7 +35,7 @@ import junit.framework.TestSuite; */ public abstract class AutowiredXMLBasedAjcTestCase extends XMLBasedAjcTestCase { - private Map testMap = new HashMap(); + private Map testMap = new HashMap<>(); public void addTest(AjcTest test) { testMap.put(test.getTitle(), test); diff --git a/testing/src/test/java/org/aspectj/testing/CompileSpec.java b/testing/src/test/java/org/aspectj/testing/CompileSpec.java index e950ee1ba..254f244a0 100644 --- a/testing/src/test/java/org/aspectj/testing/CompileSpec.java +++ b/testing/src/test/java/org/aspectj/testing/CompileSpec.java @@ -26,7 +26,7 @@ import org.aspectj.tools.ajc.CompilationResult; */ public class CompileSpec implements ITestStep { - private List expected = new ArrayList(); + private List expected = new ArrayList<>(); private String files; private boolean includeClassesDir; @@ -266,8 +266,8 @@ public class CompileSpec implements ITestStep { args.append(getExtdirs()); args.append(" "); } - List fileList = new ArrayList(); - List jarList = new ArrayList(); + List fileList = new ArrayList<>(); + List jarList = new ArrayList<>(); // convention that any jar on file list should be added to inpath String files = getFiles(); if (files == null) files = ""; @@ -310,14 +310,14 @@ public class CompileSpec implements ITestStep { protected AjcTestCase.MessageSpec buildMessageSpec() { List infos = null; - List warnings = new ArrayList(); - List errors = new ArrayList(); - List fails = new ArrayList(); - List weaveInfos = new ArrayList(); + List warnings = new ArrayList<>(); + List errors = new ArrayList<>(); + List fails = new ArrayList<>(); + List weaveInfos = new ArrayList<>(); for (ExpectedMessageSpec exMsg: expected) { String kind = exMsg.getKind(); if (kind.equals("info")) { - if (infos == null) infos = new ArrayList(); + if (infos == null) infos = new ArrayList<>(); infos.add(exMsg.toMessage()); } else if (kind.equals("warning")) { warnings.add(exMsg.toMessage()); diff --git a/testing/src/test/java/org/aspectj/testing/MakeTestClass.java b/testing/src/test/java/org/aspectj/testing/MakeTestClass.java index 721cb623b..840368c63 100644 --- a/testing/src/test/java/org/aspectj/testing/MakeTestClass.java +++ b/testing/src/test/java/org/aspectj/testing/MakeTestClass.java @@ -60,7 +60,7 @@ public class MakeTestClass { private static final String FOOTER = "}\n"; - private List tests = new ArrayList(); + private List tests = new ArrayList<>(); private String className; private String suiteFile; diff --git a/testing/src/test/java/org/aspectj/testing/OutputSpec.java b/testing/src/test/java/org/aspectj/testing/OutputSpec.java index d3b064907..62a22cb80 100644 --- a/testing/src/test/java/org/aspectj/testing/OutputSpec.java +++ b/testing/src/test/java/org/aspectj/testing/OutputSpec.java @@ -19,7 +19,7 @@ import org.aspectj.util.LangUtil; public class OutputSpec { - private List expectedOutputLines = new ArrayList(); + private List expectedOutputLines = new ArrayList<>(); public void addLine(OutputLine line) { if (line.getVm() == null || matchesThisVm(line.getVm())) { @@ -82,9 +82,9 @@ public class OutputSpec { createFailureMessage(output, -1, outputFound.size()); return; } - List expected = new ArrayList(); + List expected = new ArrayList<>(); expected.addAll(expectedOutputLines); - List found = new ArrayList(); + List found = new ArrayList<>(); found.addAll(outputFound); for (String lineFound : outputFound) { for (String lineExpected : expectedOutputLines) { @@ -119,7 +119,7 @@ public class OutputSpec { } private List getOutputFound(String output) { - List found = new ArrayList(); + List found = new ArrayList<>(); StringTokenizer strTok = new StringTokenizer(output,"\n"); while(strTok.hasMoreTokens()) { String outputLine = strTok.nextToken().trim(); diff --git a/testing/src/test/java/org/aspectj/testing/RunSpec.java b/testing/src/test/java/org/aspectj/testing/RunSpec.java index 22aa0f7bc..4f2b03cf8 100644 --- a/testing/src/test/java/org/aspectj/testing/RunSpec.java +++ b/testing/src/test/java/org/aspectj/testing/RunSpec.java @@ -27,7 +27,7 @@ import org.aspectj.util.FileUtil; */ public class RunSpec implements ITestStep { - private List expected = new ArrayList(); + private List expected = new ArrayList<>(); private String classToRun; private String moduleToRun; // alternative to classToRun on JDK9+ private String baseDir; diff --git a/testing/src/test/java/org/aspectj/testing/WeaveSpec.java b/testing/src/test/java/org/aspectj/testing/WeaveSpec.java index b0907a3c1..9d95e79b5 100644 --- a/testing/src/test/java/org/aspectj/testing/WeaveSpec.java +++ b/testing/src/test/java/org/aspectj/testing/WeaveSpec.java @@ -45,7 +45,7 @@ public class WeaveSpec extends CompileSpec { String failMessage = "test \"" + getTest().getTitle() + "\" failed"; try { File base = new File(getBaseDir()); - classFilesFromClasses = new ArrayList(); + classFilesFromClasses = new ArrayList<>(); setFiles(classesFiles); String[] args = buildArgs(); CompilationResult result = inTestCase.ajc(base,args); @@ -94,7 +94,7 @@ public class WeaveSpec extends CompileSpec { File outJar = new File(inDir,name); FileOutputStream fos = new FileOutputStream(outJar); JarOutputStream jarOut = new JarOutputStream(fos); - List classFiles = new ArrayList(); + List classFiles = new ArrayList<>(); List toExclude = isClasses ? Collections.emptyList() : classFilesFromClasses; collectClassFiles(inDir,classFiles,toExclude); if (isClasses) classFilesFromClasses = classFiles; diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java index 38f85b2c9..e5e2fcdb9 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java @@ -60,10 +60,10 @@ import junit.framework.TestSuite; */ public abstract class XMLBasedAjcTestCase extends AjcTestCase { - private static Map testMap = new HashMap(); + private static Map testMap = new HashMap<>(); private static boolean suiteLoaded = false; private AjcTest currentTest = null; - private Stack clearTestAfterRun = new Stack(); + private Stack clearTestAfterRun = new Stack<>(); public XMLBasedAjcTestCase() { } @@ -284,7 +284,7 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { protected void setUp() throws Exception { super.setUp(); if (!suiteLoaded) { - testMap = new HashMap(); + testMap = new HashMap<>(); System.out.println("LOADING SUITE: " + getSpecFile().getPath()); Digester d = getDigester(); try { @@ -413,7 +413,7 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { * Sort it by name then start position */ public List sortedLocalVariables(LocalVariableTable lvt) { - List l = new ArrayList(); + List l = new ArrayList<>(); LocalVariable lv[] = lvt.getLocalVariableTable(); for (LocalVariable lvEntry : lv) { l.add(lvEntry); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpec.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpec.java index 993d4f545..cf615f6d1 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpec.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpec.java @@ -109,11 +109,11 @@ abstract public class AbstractRunSpec implements IRunSpec { } this.xmlElementName = xmlElementName; messages = new MessageHandler(true); - options = new ArrayList(); - paths = new ArrayList(); + options = new ArrayList<>(); + paths = new ArrayList<>(); // XXXXXunused sourceLocations = new ArrayList(); - keywords = new ArrayList(); - children = new ArrayList(); + keywords = new ArrayList<>(); + children = new ArrayList<>(); dirChanges = new ArrayList<>(); xmlNames = XMLNames.DEFAULT; runtime = new RT(); @@ -371,12 +371,12 @@ abstract public class AbstractRunSpec implements IRunSpec { /** @return copy of children list without children to skip */ public ArrayList getWorkingChildren() { if (skipAll) { - return new ArrayList(); + return new ArrayList<>(); } if (null == skipSet) { return getChildren(); } - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); int i = 0; for (Iterator iter = children.listIterator(); iter.hasNext(); i++) { IRunSpec child = iter.next(); @@ -700,7 +700,7 @@ abstract public class AbstractRunSpec implements IRunSpec { } private ArrayList makeList(List list) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); if (null != list) { result.addAll(list); } @@ -779,7 +779,7 @@ abstract public class AbstractRunSpec implements IRunSpec { final private ArrayList parentOptions; public RT() { - parentOptions = new ArrayList(); + parentOptions = new ArrayList<>(); } public boolean isVerbose() { @@ -879,7 +879,7 @@ abstract public class AbstractRunSpec implements IRunSpec { if (LangUtil.isEmpty(validOptions) || LangUtil.isEmpty(parentOptions)) { return new String[0]; } - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); // boolean haveOption = false; for (String option : validOptions) { if (LangUtil.isEmpty(option)) { diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcTest.java index 64588ba93..7bbc50adf 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcTest.java @@ -119,7 +119,7 @@ public class AjcTest extends RunSpecIterator { REQUIRE_KEYWORDS, SKIP_KEYWORDS, PICK_PR })); /** Map String titlesName to List (String) of titles to accept */ - private static final Map> TITLES = new HashMap>(); + private static final Map> TITLES = new HashMap<>(); private static List getTitles(String titlesName) { return getTitles(titlesName, false); @@ -161,7 +161,7 @@ public class AjcTest extends RunSpecIterator { * @return the unmodifiable List of titles (maybe empty, never null) */ private static List parseTitlesList(String titlesList) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); String last = null; StringTokenizer st = new StringTokenizer(titlesList, ","); while (st.hasMoreTokens()) { @@ -206,7 +206,7 @@ public class AjcTest extends RunSpecIterator { * @return the unmodifiable List of titles (maybe empty, never null) */ private static List readTitlesFile(File titlesFile, boolean fail) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); Reader reader = null; try { reader = new FileReader(titlesFile); diff --git a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java index 869cb3c4c..3871ee74b 100644 --- a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java +++ b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java @@ -33,7 +33,7 @@ import junit.framework.TestCase; public class AjcTaskCompileCommandTest extends TestCase { static boolean loggedWarning = false; static boolean runAllTests = true; - static ArrayList tempFiles = new ArrayList(); + static ArrayList tempFiles = new ArrayList<>(); private static File getClassesDir() { File tempDir = FileUtil.getTempDir("AjcTaskCompileCommandTest-classes"); @@ -115,7 +115,7 @@ public class AjcTaskCompileCommandTest extends TestCase { void runSimpleTest(String path, int expectedErrors) { File file = new File(path); assertTrue(path, file.canRead()); - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); addCommonArgs(list); if (path.endsWith(".lst")) { list.add("-argfile"); diff --git a/testing/src/test/java/org/aspectj/testing/util/AccumulatingFileFilter.java b/testing/src/test/java/org/aspectj/testing/util/AccumulatingFileFilter.java index 3ee387a7f..b4d7fbf38 100644 --- a/testing/src/test/java/org/aspectj/testing/util/AccumulatingFileFilter.java +++ b/testing/src/test/java/org/aspectj/testing/util/AccumulatingFileFilter.java @@ -22,7 +22,7 @@ import java.util.Vector; * accumulated. */ public class AccumulatingFileFilter extends ValidFileFilter { - Vector files = new Vector(); + Vector files = new Vector<>(); public final boolean accept(File f) { if (super.accept(f) && (accumulate(f))) { files.add(f); diff --git a/testing/src/test/java/org/aspectj/testing/util/Diffs.java b/testing/src/test/java/org/aspectj/testing/util/Diffs.java index f42197873..c9a58e99f 100644 --- a/testing/src/test/java/org/aspectj/testing/util/Diffs.java +++ b/testing/src/test/java/org/aspectj/testing/util/Diffs.java @@ -445,7 +445,7 @@ public class Diffs { private static ArrayList getExcept( IMessage[] source, IMessage.Kind[] skip) { - ArrayList sink = new ArrayList(); + ArrayList sink = new ArrayList<>(); if (LangUtil.isEmpty(source)) { return sink; } diff --git a/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java b/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java index d7f6de21a..a576c4ae4 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java +++ b/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java @@ -186,10 +186,10 @@ public class LinkCheck { LangUtil.throwIaxIfNull(checkExists, "checkExists"); LangUtil.throwIaxIfNull(checkContents, "checkContents"); this.messages = new Messages(handler); - linksToCheck = new ArrayList(); - checkedUrls = new ArrayList(); - refsToCheck = new ArrayList(); - validRefs = new ArrayList(); + linksToCheck = new ArrayList<>(); + checkedUrls = new ArrayList<>(); + refsToCheck = new ArrayList<>(); + validRefs = new ArrayList<>(); parser = new HTMLEditorKit() { public HTMLEditorKit.Parser getParser() { return super.getParser(); @@ -221,7 +221,7 @@ public class LinkCheck { } public synchronized void run() { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); while (0 < linksToCheck.size()) { messages.checkingLinks(linksToCheck.size()); list.clear(); diff --git a/testing/src/test/java/org/aspectj/testing/util/StructureModelUtil.java b/testing/src/test/java/org/aspectj/testing/util/StructureModelUtil.java index 1763e73dd..f49ba3b87 100644 --- a/testing/src/test/java/org/aspectj/testing/util/StructureModelUtil.java +++ b/testing/src/test/java/org/aspectj/testing/util/StructureModelUtil.java @@ -248,7 +248,7 @@ public class StructureModelUtil { } else { packageContents = packageNode.getChildren(); } - List files = new ArrayList(); + List files = new ArrayList<>(); for (IProgramElement packageItem : packageContents) { if (packageItem.getKind() == IProgramElement.Kind.FILE_JAVA || packageItem.getKind() == IProgramElement.Kind.FILE_ASPECTJ) { diff --git a/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReaderTest.java b/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReaderTest.java index 796bf0399..d6ebc774e 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReaderTest.java +++ b/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReaderTest.java @@ -35,7 +35,7 @@ import junit.framework.TestCase; */ public class AjcSpecXmlReaderTest extends TestCase { - ArrayList tempFiles = new ArrayList(); + ArrayList tempFiles = new ArrayList<>(); /** * Constructor for AjcSpecXmlReaderTest. * @param name @@ -111,7 +111,7 @@ public class AjcSpecXmlReaderTest extends TestCase { String xml2Path = path + ".tmp.xml"; final File file1 = new File(xmlPath); - final ArrayList toDelete = new ArrayList(); + final ArrayList toDelete = new ArrayList<>(); final AjcSpecXmlReader writer = AjcSpecXmlReader.getReader(); assertTrue("" + file1, file1.canRead()); @@ -154,7 +154,7 @@ public class AjcSpecXmlReaderTest extends TestCase { AjcSpecXmlReader writer = AjcSpecXmlReader.getReader(); File file0 = new File(txtPath); File file1 = new File(xmlPath); - ArrayList toDelete = new ArrayList(); + ArrayList toDelete = new ArrayList<>(); AjcTest.Suite.Spec suite0 = null; if (file0.canRead()) { System.out.println("reading " + file0); diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc154/CustomMungerExtensionTest.java b/tests/src/test/java/org/aspectj/systemtest/ajc154/CustomMungerExtensionTest.java index 6b1b8821c..4f50cefca 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc154/CustomMungerExtensionTest.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc154/CustomMungerExtensionTest.java @@ -69,11 +69,11 @@ public class CustomMungerExtensionTest extends AjdeInteractionTestbed { } class DumbCustomMungerFactory implements CustomMungerFactory { - Collection allShadowMungers = new ArrayList(); - Collection allTypeMungers = new ArrayList(); + Collection allShadowMungers = new ArrayList<>(); + Collection allTypeMungers = new ArrayList<>(); public Collection createCustomShadowMungers(ResolvedType aspectType) { - List mungers = new ArrayList(); + List mungers = new ArrayList<>(); Pointcut pointcut = new IfPointcut("abc"); mungers.add(new DumbShadowMunger(new DeclareErrorOrWarning(false, pointcut, ""))); allShadowMungers.addAll(mungers); @@ -81,7 +81,7 @@ public class CustomMungerExtensionTest extends AjdeInteractionTestbed { } public Collection createCustomTypeMungers(ResolvedType aspectType) { - List mungers = new ArrayList(); + List mungers = new ArrayList<>(); mungers.add(new DumbTypeMunger(null, aspectType)); allTypeMungers.addAll(mungers); return mungers; diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java index dd032b3a4..1b8e5c69a 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java @@ -132,7 +132,7 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI private void constructUpToDateLstFile(String pname, String configname) { File projectBase = new File(sandboxDir, pname); File toConstruct = new File(projectBase, configname); - List filesForCompilation = new ArrayList(); + List filesForCompilation = new ArrayList<>(); collectUpFiles(projectBase, projectBase, filesForCompilation); try { diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index ec1965ca5..58ab1959d 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -77,7 +77,7 @@ public class AjdeInteractionTestbed extends TestCase { } public void addXmlConfigFile(String projectName, String xmlfile) { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add(xmlfile); AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setProjectXmlConfigFiles(l); @@ -116,7 +116,7 @@ public class AjdeInteractionTestbed extends TestCase { public void configureAspectPath(String projectName, File aspectpath) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - Set s = new HashSet(); + Set s = new HashSet<>(); s.add(aspectpath); ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setAspectPath(s); } @@ -137,7 +137,7 @@ public class AjdeInteractionTestbed extends TestCase { } public static void configureInPath(String projectName, File inpath) { - Set s = new HashSet(); + Set s = new HashSet<>(); s.add(inpath); AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(s); @@ -241,7 +241,7 @@ public class AjdeInteractionTestbed extends TestCase { File projectBase = new File(sandboxDir, pname); ICompilerConfiguration icc = compiler.getCompilerConfiguration(); List currentFiles = icc.getProjectSourceFiles(); - List filesForCompilation = new ArrayList(); + List filesForCompilation = new ArrayList<>(); collectUpFiles(projectBase, projectBase, filesForCompilation); boolean changed = false; for (String s : filesForCompilation) { @@ -263,7 +263,7 @@ public class AjdeInteractionTestbed extends TestCase { File projectBase = new File(sandboxDir, pname); ICompilerConfiguration icc = compiler.getCompilerConfiguration(); List currentXmlFiles = icc.getProjectXmlConfigFiles(); - List collector = new ArrayList(); + List collector = new ArrayList<>(); collectUpXmlFiles(projectBase, projectBase, collector); boolean changed = false; for (String s : collector) { @@ -501,7 +501,7 @@ public class AjdeInteractionTestbed extends TestCase { public static boolean informedAboutKindOfBuild; public static boolean fullBuildOccurred; - public static List detectedDeletions = new ArrayList(); + public static List detectedDeletions = new ArrayList<>(); public static StringBuffer decisions = new StringBuffer(); public static void reset() { diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java index 80434fa5c..5e6708a2e 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java @@ -42,7 +42,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj configureProcessorOptions("ProcessorConsumer1","DemoProcessor"); configureNonStandardCompileOptions("ProcessorConsumer1", "-showWeaveInfo"); - Hashtable javaOptions = new Hashtable(); + Hashtable javaOptions = new Hashtable<>(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); @@ -70,7 +70,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj configureProcessorPath("ProcessorConsumer2", getCompilerForProjectWithName("ProcessorProject2").getCompilerConfiguration().getOutputLocationManager().getDefaultOutputLocation().toString()+File.pathSeparator+ new File(testdataSrcDir + File.separatorChar + "ProcessorProject2" + File.separatorChar + "base"+File.separatorChar+"src").toString()); - Hashtable javaOptions = new Hashtable(); + Hashtable javaOptions = new Hashtable<>(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); @@ -108,7 +108,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj configureNonStandardCompileOptions("ProcessorConsumer1", "-showWeaveInfo"); - Hashtable javaOptions = new Hashtable(); + Hashtable javaOptions = new Hashtable<>(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); @@ -144,7 +144,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj } private void checkCompiledFiles(String projectName, String... expectedCompiledFiles) { - List compiledFiles = new ArrayList(getCompiledFiles(projectName)); + List compiledFiles = new ArrayList<>(getCompiledFiles(projectName)); if (compiledFiles.size()!=expectedCompiledFiles.length) { fail("Expected #"+expectedCompiledFiles.length+" files to be compiled but found that #"+compiledFiles.size()+" files were compiled.\nCompiled="+compiledFiles); } diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestBuildProgressMonitor.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestBuildProgressMonitor.java index 6218ce3e4..bbdb4a379 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestBuildProgressMonitor.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestBuildProgressMonitor.java @@ -23,8 +23,8 @@ public class MultiProjTestBuildProgressMonitor implements IBuildProgressMonitor public boolean VERBOSE = false; - private List compiledFiles = new ArrayList(); - private List wovenClasses = new ArrayList(); + private List compiledFiles = new ArrayList<>(); + private List wovenClasses = new ArrayList<>(); private long starttime = 0; private long totaltimetaken = 0; diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java index e30c6f0ee..36be6773e 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java @@ -107,7 +107,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio if (javaOptionsMap != null && !javaOptionsMap.isEmpty()) return javaOptionsMap; - Hashtable ht = new Hashtable(); + Hashtable ht = new Hashtable<>(); ht.put("org.eclipse.jdt.core.compiler.compliance", "1.5"); ht.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5"); ht.put("org.eclipse.jdt.core.compiler.source", "1.5"); @@ -158,7 +158,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio public void addDependancy(String projectItDependsOn) { if (dependants == null) { - dependants = new ArrayList(); + dependants = new ArrayList<>(); } dependants.add(projectItDependsOn); } @@ -211,7 +211,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio public void addProjectSourceFileChanged(File f) { if (this.modifiedFiles == null) { - this.modifiedFiles = new ArrayList(); + this.modifiedFiles = new ArrayList<>(); } if (f != null) { modifiedFiles.add(f); @@ -220,7 +220,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio public void addClasspathEntryChanged(String f) { if (this.modifiedDirs == null) { - this.modifiedDirs = new ArrayList(); + this.modifiedDirs = new ArrayList<>(); } if (f != null) { modifiedDirs.add(f); diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java index fa66bede7..24018e001 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java @@ -37,9 +37,9 @@ public class MultiProjTestMessageHandler implements IBuildMessageHandler { public MultiProjTestMessageHandler() { ignoring = new ArrayList<>(); - errorMessages = new ArrayList(); - warningMessages = new ArrayList(); - weavingMessages = new ArrayList(); + errorMessages = new ArrayList<>(); + warningMessages = new ArrayList<>(); + weavingMessages = new ArrayList<>(); compilerErrors = new ArrayList<>(); ignore(IMessage.INFO); ignore(IMessage.WEAVEINFO); diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index c4ea8f120..30793c396 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -713,7 +713,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testOutputLocationCallbacks2() { String p = "pr268827_ol_res"; initialiseProject(p); - Map m = new HashMap(); + Map m = new HashMap<>(); m.put("a.txt", new File(getFile(p, "src/a.txt"))); configureResourceMap(p, m); CustomOLM olm = new CustomOLM(getProjectRelativePath(p, ".").toString()); @@ -808,7 +808,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa String p = "pr266420"; initialiseProject(p); - Hashtable javaOptions = new Hashtable(); + Hashtable javaOptions = new Hashtable<>(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); @@ -1635,7 +1635,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testInvalidAspectpath_pr121395() { initialiseProject("P1"); File f = new File("foo.jar"); - Set s = new HashSet(); + Set s = new HashSet<>(); s.add(f); configureAspectPath("P1", s); build("P1"); // This first build will be batch @@ -2188,7 +2188,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa List viaIteratorList = exhaustTypeIterator(typeA.getHierarchy(wantGenerics, false)); List typeDirectlyList = typeA.getHierarchyWithoutIterator(true, true, wantGenerics); assertFalse(viaIteratorList.isEmpty()); - List directlyList = new ArrayList(); + List directlyList = new ArrayList<>(); for (ResolvedType type : typeDirectlyList) { String n = type.getName(); if (!directlyList.contains(n)) { @@ -2252,7 +2252,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa } private List getThemAll(Iterator methods) { - List allOfThem = new ArrayList(); + List allOfThem = new ArrayList<>(); while (methods.hasNext()) { allOfThem.add(methods.next()); } @@ -2260,7 +2260,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa } private List exhaustTypeIterator(Iterator types) { - List allOfThem = new ArrayList(); + List allOfThem = new ArrayList<>(); while (types.hasNext()) { allOfThem.add(types.next().getName()); } @@ -3614,7 +3614,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testPR164384_1() { initialiseProject("PR164384"); - Hashtable javaOptions = new Hashtable(); + Hashtable javaOptions = new Hashtable<>(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); @@ -3646,7 +3646,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testPR164384_2() { initialiseProject("PR164384"); - Hashtable javaOptions = new Hashtable(); + Hashtable javaOptions = new Hashtable<>(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5"); @@ -3676,7 +3676,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testPR164384_3() { initialiseProject("PR164384"); - Hashtable javaOptions = new Hashtable(); + Hashtable javaOptions = new Hashtable<>(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5"); @@ -3709,7 +3709,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa // set up the inpath to have the directory on it's path File f = new File(inpathDir); - Set s = new HashSet(); + Set s = new HashSet<>(); s.add(f); configureInPath("inpathTesting", s); build("inpathTesting"); @@ -3744,7 +3744,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa // set up the inpath to have the directory on it's path System.out.println(inpathDir); File f = new File(inpathDir); - Set s = new HashSet(); + Set s = new HashSet<>(); s.add(f); configureInPath(p, s); build(p); @@ -3775,7 +3775,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa // set up the inpath to have the directory on it's path File f = new File(inpathDir); - Set s = new HashSet(); + Set s = new HashSet<>(); s.add(f); configureInPath(p, s); @@ -3813,9 +3813,9 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa // set up the inpath to have the directory on it's path System.out.println(inpathDir); File f = new File(inpathDir); - Set s = new HashSet(); + Set s = new HashSet<>(); s.add(f); - Map m = new HashMap(); + Map m = new HashMap<>(); m.put(f, "wibble"); configureOutputLocationManager(p, new TestOutputLocationManager(getProjectRelativePath(p, ".").toString(), m)); @@ -3934,7 +3934,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa for (IRelationship element : rels) { List targets = element.getTargets(); if (output == null) { - output = new ArrayList(); + output = new ArrayList<>(); } output.addAll(targets); } diff --git a/tests/src/test/java/org/aspectj/systemtest/model/ModelTestCase.java b/tests/src/test/java/org/aspectj/systemtest/model/ModelTestCase.java index b2c3ca6c9..c0cf11977 100644 --- a/tests/src/test/java/org/aspectj/systemtest/model/ModelTestCase.java +++ b/tests/src/test/java/org/aspectj/systemtest/model/ModelTestCase.java @@ -133,7 +133,7 @@ public abstract class ModelTestCase extends XMLBasedAjcTestCase { private void compareModel(File expectedF) { if (debugTest) System.out.println("comparing with model in file " + expectedF.getAbsolutePath()); - List fileContents = new ArrayList(); + List fileContents = new ArrayList<>(); try { // String sandboxDir = ajc.getSandboxDirectory().getAbsolutePath(); String modelOutput = modelFilename; @@ -144,13 +144,13 @@ public abstract class ModelTestCase extends XMLBasedAjcTestCase { while ((expectedLine = expect.readLine()) != null) { fileContents.add(expectedLine); } - List expectedFileContents = new ArrayList(); + List expectedFileContents = new ArrayList<>(); expectedFileContents.addAll(fileContents); // Load the file with the output from this test run BufferedReader found = new BufferedReader(new FileReader(new File(modelOutput))); String foundLine = null; - List foundFileContents = new ArrayList(); + List foundFileContents = new ArrayList<>(); while ((foundLine = found.readLine()) != null) { // int i = foundLine.indexOf(sandboxDir); // if (i == -1) { diff --git a/util/src/main/java/org/aspectj/util/FileUtil.java b/util/src/main/java/org/aspectj/util/FileUtil.java index 1927f47a0..976c3ccbc 100644 --- a/util/src/main/java/org/aspectj/util/FileUtil.java +++ b/util/src/main/java/org/aspectj/util/FileUtil.java @@ -686,7 +686,7 @@ public class FileUtil { * @return ArrayList with String paths of File under srcDir (relative to srcDir) */ public static String[] listFiles(File srcDir) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); if ((null != srcDir) && srcDir.canRead()) { listFiles(srcDir, null, result); } @@ -706,7 +706,7 @@ public class FileUtil { * @return ArrayList with String paths of File under srcDir (relative to srcDir) */ public static File[] listFiles(File srcDir, FileFilter fileFilter) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); if ((null != srcDir) && srcDir.canRead()) { listFiles(srcDir, result, fileFilter); } @@ -719,7 +719,7 @@ public class FileUtil { * @return List of File objects */ public static List listClassFiles(File dir) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); if ((null != dir) && dir.canRead()) { listClassFiles(dir, result); } @@ -750,7 +750,7 @@ public class FileUtil { LangUtil.throwIaxIfNull(paths, "paths"); File[] result = null; if (!LangUtil.isEmpty(suffixes)) { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); for (String path : paths) { for (String suffix : suffixes) { if (path.endsWith(suffix)) { @@ -1273,7 +1273,7 @@ public class FileUtil { if (LangUtil.isEmpty(sought) || LangUtil.isEmpty(sources)) { return Collections.emptyList(); } - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); for (String path : sources) { String error = lineSeek(sought, path, listAll, result); if ((null != error) && (null != errorSink)) { @@ -1427,7 +1427,7 @@ public class FileUtil { } public static List makeClasspath(URL[] urls) { - List ret = new LinkedList(); + List ret = new LinkedList<>(); if (urls != null) { for (URL url : urls) { ret.add(toPathString(url)); diff --git a/util/src/main/java/org/aspectj/util/GenericSignatureParser.java b/util/src/main/java/org/aspectj/util/GenericSignatureParser.java index 27670cc00..3e1e0e7b3 100644 --- a/util/src/main/java/org/aspectj/util/GenericSignatureParser.java +++ b/util/src/main/java/org/aspectj/util/GenericSignatureParser.java @@ -46,7 +46,7 @@ public class GenericSignatureParser { GenericSignature.ClassSignature classSig = new GenericSignature.ClassSignature(); // FormalTypeParameters-opt if (maybeEat("<")) { - List formalTypeParametersList = new ArrayList(); + List formalTypeParametersList = new ArrayList<>(); do { formalTypeParametersList.add(parseFormalTypeParameter()); } while (!maybeEat(">")); @@ -54,7 +54,7 @@ public class GenericSignatureParser { formalTypeParametersList.toArray(classSig.formalTypeParameters); } classSig.superclassSignature = parseClassTypeSignature(); - List superIntSigs = new ArrayList(); + List superIntSigs = new ArrayList<>(); while (tokenIndex < tokenStream.length) { superIntSigs.add(parseClassTypeSignature()); } @@ -75,7 +75,7 @@ public class GenericSignatureParser { TypeSignature returnType = null; // FormalTypeParameters-opt if (maybeEat("<")) { - List formalTypeParametersList = new ArrayList(); + List formalTypeParametersList = new ArrayList<>(); do { formalTypeParametersList.add(parseFormalTypeParameter()); } while (!maybeEat(">")); @@ -84,7 +84,7 @@ public class GenericSignatureParser { } // Parameters eat("("); - List paramList = new ArrayList(); + List paramList = new ArrayList<>(); while (!maybeEat(")")) { FieldTypeSignature fsig = parseFieldTypeSignature(true); if (fsig != null) { @@ -100,7 +100,7 @@ public class GenericSignatureParser { if (returnType == null) returnType = new GenericSignature.BaseTypeSignature(eatIdentifier()); // throws - List throwsList = new ArrayList(); + List throwsList = new ArrayList<>(); while (maybeEat("^")) { FieldTypeSignature fsig = parseFieldTypeSignature(false); throwsList.add(fsig); @@ -132,7 +132,7 @@ public class GenericSignatureParser { ftp.classBound = new ClassTypeSignature("Ljava/lang/Object;", "Ljava/lang/Object"); } // Optional InterfaceBounds - List optionalBounds = new ArrayList(); + List optionalBounds = new ArrayList<>(); while (maybeEat(":")) { optionalBounds.add(parseFieldTypeSignature(false)); } @@ -218,7 +218,7 @@ public class GenericSignatureParser { private SimpleClassTypeSignature[] parseNestedTypesHelper(StringBuffer ret) { boolean brokenSignature = false; SimpleClassTypeSignature[] nestedTypes; - List nestedTypeList = new ArrayList(); + List nestedTypeList = new ArrayList<>(); while (maybeEat(".")) { ret.append("."); SimpleClassTypeSignature sig = parseSimpleClassTypeSignature(); @@ -270,7 +270,7 @@ public class GenericSignatureParser { private TypeArgument[] maybeParseTypeArguments() { if (maybeEat("<")) { - List typeArgs = new ArrayList(); + List typeArgs = new ArrayList<>(); do { TypeArgument arg = parseTypeArgument(); typeArgs.add(arg); @@ -317,7 +317,7 @@ public class GenericSignatureParser { public String[] tokenize(String signatureString) { char[] chars = signatureString.toCharArray(); int index = 0; - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); StringBuffer identifier = new StringBuffer(); boolean inParens = false; boolean inArray = false; diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java index ffdc0b66e..5c656cd7a 100644 --- a/util/src/main/java/org/aspectj/util/LangUtil.java +++ b/util/src/main/java/org/aspectj/util/LangUtil.java @@ -113,7 +113,7 @@ public class LangUtil { } private static List getFirstNumbers(String vm) { - List result = new ArrayList(); + List result = new ArrayList<>(); StringTokenizer st = new StringTokenizer(vm,".-_"); try { result.add(Integer.parseInt(st.nextToken())); @@ -312,7 +312,7 @@ public class LangUtil { return new String[0]; } StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator); - ArrayList result = new ArrayList(st.countTokens()); + ArrayList result = new ArrayList<>(st.countTokens()); while (st.hasMoreTokens()) { String entry = st.nextToken(); if (!LangUtil.isEmpty(entry)) { @@ -354,7 +354,7 @@ public class LangUtil { if (null == input) { return Collections.emptyList(); } - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); if (LangUtil.isEmpty(delim) || (!input.contains(delim))) { result.add(input.trim()); @@ -376,7 +376,7 @@ public class LangUtil { if (LangUtil.isEmpty(text)) { return Collections.emptyList(); } - List strings = new ArrayList(); + List strings = new ArrayList<>(); StringTokenizer tok = new StringTokenizer(text); while (tok.hasMoreTokens()) { strings.add(tok.nextToken()); @@ -740,7 +740,7 @@ public class LangUtil { if (0 == sourceLength) { resultSize = 0; } else { - result = new ArrayList(sourceLength); + result = new ArrayList<>(sourceLength); for (int i = 0; i < sourceLength; i++) { if ((null != source[i]) && (sinkType.isAssignableFrom(source[i].getClass()))) { result.add(source[i]); @@ -897,7 +897,7 @@ public class LangUtil { if (null == checker || (null == stack) || (0 == stack.length())) { return; } - final LinkedList lines = new LinkedList(); + final LinkedList lines = new LinkedList<>(); StringTokenizer st = new StringTokenizer(stack.toString(), "\n\r"); while (st.hasMoreTokens() && (0 < --maxLines)) { lines.add(st.nextToken()); @@ -995,7 +995,7 @@ public class LangUtil { if ((null == array) || (1 > array.length)) { return Collections.emptyList(); } - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.addAll(Arrays.asList(array)); return list; } @@ -1073,7 +1073,7 @@ public class LangUtil { */ public static ProcessController makeProcess(ProcessController controller, String classpath, String mainClass, String[] args) { File java = LangUtil.getJavaExecutable(); - ArrayList cmd = new ArrayList(); + ArrayList cmd = new ArrayList<>(); cmd.add(java.getAbsolutePath()); cmd.add("-classpath"); cmd.add(classpath); @@ -1262,7 +1262,7 @@ public class LangUtil { LangUtil.throwIaxIfNull(java, "java"); LangUtil.throwIaxIfNull(mainClass, "mainClass"); LangUtil.throwIaxIfNull(args, "args"); - ArrayList cmd = new ArrayList(); + ArrayList cmd = new ArrayList<>(); cmd.add(java.getAbsolutePath()); cmd.add("-classpath"); cmd.add(classpath); diff --git a/util/src/main/java/org/aspectj/util/PartialOrder.java b/util/src/main/java/org/aspectj/util/PartialOrder.java index 14f23b0d6..be59104a0 100644 --- a/util/src/main/java/org/aspectj/util/PartialOrder.java +++ b/util/src/main/java/org/aspectj/util/PartialOrder.java @@ -51,8 +51,8 @@ public class PartialOrder { private static class SortObject { T object; - List> smallerObjects = new LinkedList>(); - List> biggerObjects = new LinkedList>(); + List> smallerObjects = new LinkedList<>(); + List> biggerObjects = new LinkedList<>(); public SortObject(T o) { object = o; @@ -87,7 +87,7 @@ public class PartialOrder { } private static void addNewPartialComparable(List> graph, T o) { - SortObject so = new SortObject(o); + SortObject so = new SortObject<>(o); for (SortObject other : graph) { so.addDirectedLinks(other); } @@ -123,7 +123,7 @@ public class PartialOrder { // ??? I don't like creating this data structure, but it does give good // ??? separation of concerns. - List> sortList = new LinkedList>(); + List> sortList = new LinkedList<>(); for (T object : objects) { addNewPartialComparable(sortList, object); } @@ -193,7 +193,7 @@ public class PartialOrder { } public static void main(String[] args) { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add(new Token("a1")); l.add(new Token("c2")); l.add(new Token("b3")); diff --git a/util/src/main/java/org/aspectj/util/Reflection.java b/util/src/main/java/org/aspectj/util/Reflection.java index d78f67101..614bb4b76 100644 --- a/util/src/main/java/org/aspectj/util/Reflection.java +++ b/util/src/main/java/org/aspectj/util/Reflection.java @@ -96,9 +96,9 @@ public class Reflection { runMainInSameVM(mainClass, args); return; } - ArrayList dirs = new ArrayList(); - ArrayList libs = new ArrayList(); - ArrayList urls = new ArrayList(); + ArrayList dirs = new ArrayList<>(); + ArrayList libs = new ArrayList<>(); + ArrayList urls = new ArrayList<>(); String[] entries = LangUtil.splitClasspath(classpath); for (String entry : entries) { URL url = makeURL(entry); diff --git a/util/src/main/java/org/aspectj/util/SoftHashMap.java b/util/src/main/java/org/aspectj/util/SoftHashMap.java index 7660525d1..8af2e6304 100644 --- a/util/src/main/java/org/aspectj/util/SoftHashMap.java +++ b/util/src/main/java/org/aspectj/util/SoftHashMap.java @@ -19,7 +19,7 @@ public class SoftHashMap extends AbstractMap { private ReferenceQueue rq = new ReferenceQueue(); public SoftHashMap() { - this.map = new HashMap(); + this.map = new HashMap<>(); } class SpecialValue extends SoftReference { @@ -65,7 +65,7 @@ public class SoftHashMap extends AbstractMap { @Override public java.util.Set> entrySet() { if (map.isEmpty()) { return Collections.emptyMap().entrySet(); } - Map currentContents = new HashMap(); + Map currentContents = new HashMap<>(); for (Map.Entry entry: map.entrySet()) { V currentValueForEntry = entry.getValue().get(); if (currentValueForEntry != null) { diff --git a/util/src/main/java/org/aspectj/util/UtilClassLoader.java b/util/src/main/java/org/aspectj/util/UtilClassLoader.java index 4704bfcc9..b4d09533f 100644 --- a/util/src/main/java/org/aspectj/util/UtilClassLoader.java +++ b/util/src/main/java/org/aspectj/util/UtilClassLoader.java @@ -40,7 +40,7 @@ public class UtilClassLoader extends URLClassLoader { super(urls); LangUtil.throwIaxIfNotAssignable(dirs, File.class, "dirs"); this.urlsForDebugString = urls; - ArrayList dcopy = new ArrayList(); + ArrayList dcopy = new ArrayList<>(); if (!LangUtil.isEmpty(dirs)) { dcopy.addAll(Arrays.asList(dirs)); diff --git a/util/src/test/java/org/aspectj/util/FileUtilTest.java b/util/src/test/java/org/aspectj/util/FileUtilTest.java index 663352be6..7936914fb 100644 --- a/util/src/test/java/org/aspectj/util/FileUtilTest.java +++ b/util/src/test/java/org/aspectj/util/FileUtilTest.java @@ -129,7 +129,7 @@ public class FileUtilTest extends TestCase { * @return sorted String[] of all paths to all files under dir ending with one of the listed suffixes but not starting with "." */ public static String[] dirPaths(File dir, String[] suffixes) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); doDirPaths(dir, result); // if suffixes required, remove those without suffixes if (!LangUtil.isEmpty(suffixes)) { @@ -192,7 +192,7 @@ public class FileUtilTest extends TestCase { public FileUtilTest(String s) { super(s); - tempFiles = new ArrayList(); + tempFiles = new ArrayList<>(); } public void tearDown() { @@ -459,10 +459,10 @@ public class FileUtilTest extends TestCase { contents += contents; FileUtil.writeAsString(file, contents); tempFiles.add(file); - List sourceList = new ArrayList(); + List sourceList = new ArrayList<>(); sourceList.add(file.getPath()); - final ArrayList errors = new ArrayList(); + final ArrayList errors = new ArrayList<>(); final PrintStream errorSink = new PrintStream(System.err, true) { public void println(String error) { errors.add(error); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java index 971ee314d..b91496ea7 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java @@ -109,7 +109,7 @@ public class AtAjAttributes { /** * The list of AjAttribute.XXX that we are populating from the @AJ read */ - List ajAttributes = new ArrayList(); + List ajAttributes = new ArrayList<>(); /** * The resolved type (class) for which we are reading @AJ for (be it class, method, field annotations) @@ -721,7 +721,7 @@ public class AtAjAttributes { FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0]; IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings); // first add the declare implements like - List parents = new ArrayList(1); + List parents = new ArrayList<>(1); parents.add(parent); DeclareParents dp = new DeclareParents(typePattern, parents, false); dp.resolve(binding); // resolves the parent and child parts of the decp @@ -923,8 +923,8 @@ public class AtAjAttributes { // supplied as just the class return value of the annotated method NameValuePair interfaceListSpecified = getAnnotationElement(declareMixinAnnotation, "interfaces"); - List newParents = new ArrayList(1); - List newInterfaceTypes = new ArrayList(1); + List newParents = new ArrayList<>(1); + List newInterfaceTypes = new ArrayList<>(1); if (interfaceListSpecified != null) { ArrayElementValue arrayOfInterfaceTypes = (ArrayElementValue) interfaceListSpecified.getValue(); int numberOfTypes = arrayOfInterfaceTypes.getElementValuesArraySize(); @@ -1558,7 +1558,7 @@ public class AtAjAttributes { throw new UnreadableDebugInfoException(); } - List bindings = new ArrayList(); + List bindings = new ArrayList<>(); for (int i = 0; i < argumentNames.length; i++) { String argumentName = argumentNames[i]; UnresolvedType argumentType = UnresolvedType.forSignature(method.getArgumentTypes()[i].getSignature()); @@ -1726,7 +1726,7 @@ public class AtAjAttributes { } final int startAtStackIndex = method.isStatic() ? 0 : 1; - final List arguments = new ArrayList(); + final List arguments = new ArrayList<>(); LocalVariableTable lt = method.getLocalVariableTable(); if (lt != null) { LocalVariable[] lvt = lt.getLocalVariableTable(); @@ -1807,7 +1807,7 @@ public class AtAjAttributes { private static String[] extractArgNamesFromAnnotationValue(Method method, String argNamesFromAnnotation, AjAttributeMethodStruct methodStruct) { StringTokenizer st = new StringTokenizer(argNamesFromAnnotation, " ,"); - List args = new ArrayList(); + List args = new ArrayList<>(); while (st.hasMoreTokens()) { args.add(st.nextToken()); } @@ -1899,7 +1899,7 @@ public class AtAjAttributes { private static void setIgnoreUnboundBindingNames(Pointcut pointcut, FormalBinding[] bindings) { // register ImplicitBindings as to be ignored since unbound // TODO is it likely to fail in a bad way if f.e. this(jp) etc ? - List ignores = new ArrayList(); + List ignores = new ArrayList<>(); for (FormalBinding formalBinding : bindings) { if (formalBinding instanceof FormalBinding.ImplicitFormalBinding) { ignores.add(formalBinding.getName()); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java index 8d2709966..497df1a3a 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java @@ -72,8 +72,8 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger { @Override public boolean munge(BcelClassWeaver weaver) { aspectGen = weaver.getLazyClassGen(); - inlineAccessors = new HashMap(0); - inlineAccessorMethodGens = new HashSet(); + inlineAccessors = new HashMap<>(0); + inlineAccessorMethodGens = new HashSet<>(); // look for all @Around advices for (LazyMethodGen methodGen : aspectGen.getMethodGens()) { @@ -238,7 +238,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger { InstructionFactory factory = aspectGen.getFactory(); LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor); method.makeSynthetic(); - List methodAttributes = new ArrayList(); + List methodAttributes = new ArrayList<>(); methodAttributes.add(new AjAttribute.AjSynthetic()); methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.MethodCall, false)); method.addAttribute(Utility.bcelAttribute(methodAttributes.get(0), aspectGen.getConstantPool())); @@ -282,7 +282,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger { LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor); // flag it synthetic, AjSynthetic method.makeSynthetic(); - List methodAttributes = new ArrayList(); + List methodAttributes = new ArrayList<>(); methodAttributes.add(new AjAttribute.AjSynthetic()); methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.MethodCall, false)); method.addAttribute(Utility.bcelAttribute(methodAttributes.get(0), aspectGen.getConstantPool())); @@ -326,7 +326,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger { LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor); // flag it synthetic, AjSynthetic method.makeSynthetic(); - List methodAttributes = new ArrayList(); + List methodAttributes = new ArrayList<>(); methodAttributes.add(new AjAttribute.AjSynthetic()); methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.FieldGet, false)); // flag the effective signature, so that we can deobfuscate the signature to apply method call pointcut @@ -367,7 +367,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger { LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor); // flag it synthetic, AjSynthetic method.makeSynthetic(); - List methodAttributes = new ArrayList(); + List methodAttributes = new ArrayList<>(); methodAttributes.add(new AjAttribute.AjSynthetic()); methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.FieldSet, false)); method.addAttribute(Utility.bcelAttribute(methodAttributes.get(0), aspectGen.getConstantPool())); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java index 7736addcd..85cd66e54 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java @@ -423,7 +423,7 @@ class BcelAdvice extends Advice { return Collections.emptyList(); } - Collection ret = new ArrayList(); + Collection ret = new ArrayList<>(); World world = concreteAspect.getWorld(); ResolvedType runtimeException = world.getCoreType(UnresolvedType.RUNTIME_EXCEPTION); ResolvedType error = world.getCoreType(UnresolvedType.ERROR); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java index b11afc77d..73699f2a0 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java @@ -75,7 +75,7 @@ public class BcelAnnotation extends AbstractAnnotationAJ { NameValuePair envp = values.get(0); ArrayElementValue aev = (ArrayElementValue) envp.getValue(); ElementValue[] evs = aev.getElementValuesArray(); - Set targets = new HashSet(); + Set targets = new HashSet<>(); for (ElementValue elementValue : evs) { EnumElementValue ev = (EnumElementValue) elementValue; targets.add(ev.getEnumValueString()); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java index 2e0b8e5f3..8bd479332 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -119,17 +119,17 @@ class BcelClassWeaver implements IClassWeaver { private final ConstantPool cpg; // alias of clazz.getConstantPoolGen() private final InstructionFactory fact; // alias of clazz.getFactory(); - private final List addedLazyMethodGens = new ArrayList(); - private final Set addedDispatchTargets = new HashSet(); + private final List addedLazyMethodGens = new ArrayList<>(); + private final Set addedDispatchTargets = new HashSet<>(); private boolean inReweavableMode = false; private List addedSuperInitializersAsList = null; - private final Map addedSuperInitializers = new HashMap(); - private final List addedThisInitializers = new ArrayList(); - private final List addedClassInitializers = new ArrayList(); + private final Map addedSuperInitializers = new HashMap<>(); + private final List addedThisInitializers = new ArrayList<>(); + private final List addedClassInitializers = new ArrayList<>(); - private final Map mapToAnnotationHolder = new HashMap(); + private final Map mapToAnnotationHolder = new HashMap<>(); // private BcelShadow clinitShadow = null; @@ -137,7 +137,7 @@ class BcelClassWeaver implements IClassWeaver { * This holds the initialization and pre-initialization shadows for this class that were actually matched by mungers (if no * match, then we don't even create the shadows really). */ - private final List initializationShadows = new ArrayList(); + private final List initializationShadows = new ArrayList<>(); private BcelClassWeaver(BcelWorld world, LazyClassGen clazz, List shadowMungers, List typeMungers, List lateTypeMungers) { @@ -209,7 +209,7 @@ class BcelClassWeaver implements IClassWeaver { if (kind.isSet(couldMatchKinds)) { byte k = kind.getKey(); if (indexedShadowMungers[k] == null) { - indexedShadowMungers[k] = new ArrayList(); + indexedShadowMungers[k] = new ArrayList<>(); if (!kind.isEnclosingKind()) { canMatchBodyShadows = true; } @@ -254,7 +254,7 @@ class BcelClassWeaver implements IClassWeaver { private static class IfaceInitList implements PartialOrder.PartialComparable { final ResolvedType onType; - List list = new ArrayList(); + List list = new ArrayList<>(); IfaceInitList(ResolvedType onType) { this.onType = onType; @@ -418,7 +418,7 @@ class BcelClassWeaver implements IClassWeaver { Set aspectsAffectingType = null; if (inReweavableMode || clazz.getType().isAspect()) { - aspectsAffectingType = new HashSet(); + aspectsAffectingType = new HashSet<>(); } boolean isChanged = false; @@ -457,7 +457,7 @@ class BcelClassWeaver implements IClassWeaver { // sort according to: Major: type hierarchy // within each list: dominates // don't forget to sort addedThisInitialiers according to dominates - addedSuperInitializersAsList = new ArrayList(addedSuperInitializers.values()); + addedSuperInitializersAsList = new ArrayList<>(addedSuperInitializers.values()); addedSuperInitializersAsList = PartialOrder.sort(addedSuperInitializersAsList); if (addedSuperInitializersAsList == null) { throw new BCException("circularity in inter-types"); @@ -471,7 +471,7 @@ class BcelClassWeaver implements IClassWeaver { // now go through each method, and match against each method. This // sets up each method's {@link LazyMethodGen#matchedShadows} field, // and it also possibly adds to {@link #initializationShadows}. - List methodGens = new ArrayList(clazz.getMethodGens()); + List methodGens = new ArrayList<>(clazz.getMethodGens()); for (LazyMethodGen member : methodGens) { if (!member.hasBody()) { continue; @@ -504,7 +504,7 @@ class BcelClassWeaver implements IClassWeaver { // Repeat next step until nothing left to inline...cant go on // infinetly as compiler will have detected and reported // "Recursive constructor invocation" - List recursiveCtors = new ArrayList(); + List recursiveCtors = new ArrayList<>(); while (inlineSelfConstructors(methodGens, recursiveCtors)) { } positionAndImplement(initializationShadows); @@ -789,7 +789,7 @@ class BcelClassWeaver implements IClassWeaver { // Keep a set of all methods from this type - it'll help us to check if bridge methods // have already been created, we don't want to do it twice! - Set methodsSet = new HashSet(); + Set methodsSet = new HashSet<>(); for (LazyMethodGen aMethod : methods) { StringBuilder sb = new StringBuilder(aMethod.getName()); sb.append(aMethod.getSignature()); @@ -825,7 +825,7 @@ class BcelClassWeaver implements IClassWeaver { } String pkgName = clazz.getPackageName(); UnresolvedType[] bm = BcelWorld.fromBcel(bridgeToCandidate.getArgumentTypes()); - List overriddenMethodsCollector = new ArrayList(); + List overriddenMethodsCollector = new ArrayList<>(); checkForOverride(theSuperclass, name, psig, rsig, bridgeToCandidate.getAccessFlags(), pkgName, bm, overriddenMethodsCollector); if (overriddenMethodsCollector.size() != 0) { for (ResolvedMember overriddenMethod : overriddenMethodsCollector) { @@ -876,7 +876,7 @@ class BcelClassWeaver implements IClassWeaver { * Weave any declare @method/@ctor statements into the members of the supplied class */ private boolean weaveDeclareAtMethodCtor(LazyClassGen clazz) { - List reportedProblems = new ArrayList(); + List reportedProblems = new ArrayList<>(); List allDecams = world.getDeclareAnnotationOnMethods(); if (allDecams.isEmpty()) { @@ -899,7 +899,7 @@ class BcelClassWeaver implements IClassWeaver { return false; // nothing to do } - Set unusedDecams = new HashSet(); + Set unusedDecams = new HashSet<>(); unusedDecams.addAll(decaMs); // These methods may have been targeted with declare annotation. Example: ITD on an interface @@ -915,7 +915,7 @@ class BcelClassWeaver implements IClassWeaver { resolvedmember.setAnnotationTypes(method.getAnnotationTypes()); resolvedmember.setAnnotations(method.getAnnotations()); - List worthRetrying = new ArrayList(); + List worthRetrying = new ArrayList<>(); boolean modificationOccured = false; for (DeclareAnnotation decam: decaMs) { if (decam.matches(resolvedmember, world)) { @@ -947,7 +947,7 @@ class BcelClassWeaver implements IClassWeaver { while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; // lets have another go - List forRemoval = new ArrayList(); + List forRemoval = new ArrayList<>(); for (DeclareAnnotation decam : worthRetrying) { if (decam.matches(resolvedmember, world)) { if (doesAlreadyHaveAnnotation(resolvedmember, decam, reportedProblems,false)) { @@ -984,7 +984,7 @@ class BcelClassWeaver implements IClassWeaver { if (!mg.getName().startsWith(NameMangler.PREFIX)) { // Single first pass - List worthRetrying = new ArrayList(); + List worthRetrying = new ArrayList<>(); boolean modificationOccured = false; List annotationsToAdd = null; for (DeclareAnnotation decaM : decaMs) { @@ -998,7 +998,7 @@ class BcelClassWeaver implements IClassWeaver { } if (annotationsToAdd == null) { - annotationsToAdd = new ArrayList(); + annotationsToAdd = new ArrayList<>(); } AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation(); AnnotationGen ag = new AnnotationGen(a, clazz.getConstantPool(), true); @@ -1028,7 +1028,7 @@ class BcelClassWeaver implements IClassWeaver { while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; // lets have another go - List forRemoval = new ArrayList(); + List forRemoval = new ArrayList<>(); for (DeclareAnnotation decaM : worthRetrying) { if (decaM.matches(mg.getMemberView(), world)) { if (doesAlreadyHaveAnnotation(mg.getMemberView(), decaM, reportedProblems,true)) { @@ -1040,7 +1040,7 @@ class BcelClassWeaver implements IClassWeaver { } if (annotationsToAdd == null) { - annotationsToAdd = new ArrayList(); + annotationsToAdd = new ArrayList<>(); } AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation(); // create copy to get the annotation type into the right constant pool @@ -1128,7 +1128,7 @@ class BcelClassWeaver implements IClassWeaver { * in type. */ private List getMatchingSubset(List declareAnnotations, ResolvedType type) { - List subset = new ArrayList(); + List subset = new ArrayList<>(); for (DeclareAnnotation da : declareAnnotations) { if (da.couldEverMatch(type)) { subset.add(da); @@ -1141,7 +1141,7 @@ class BcelClassWeaver implements IClassWeaver { * Get a subset of all the type mungers defined on this aspect */ private List getITDSubset(LazyClassGen clazz, ResolvedTypeMunger.Kind wantedKind) { - List subset = new ArrayList(); + List subset = new ArrayList<>(); for (ConcreteTypeMunger typeMunger : clazz.getBcelObjectType().getTypeMungers()) { if (typeMunger.getMunger().getKind() == wantedKind) { subset.add(typeMunger); @@ -1196,7 +1196,7 @@ class BcelClassWeaver implements IClassWeaver { for (ConcreteTypeMunger itdField : itdFields) { BcelTypeMunger fieldMunger = (BcelTypeMunger) itdField; ResolvedMember itdIsActually = fieldMunger.getSignature(); - Set worthRetrying = new LinkedHashSet(); + Set worthRetrying = new LinkedHashSet<>(); boolean modificationOccured = false; for (DeclareAnnotation decaF : decaFs) { @@ -1235,7 +1235,7 @@ class BcelClassWeaver implements IClassWeaver { while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; - List forRemoval = new ArrayList(); + List forRemoval = new ArrayList<>(); for (DeclareAnnotation decaF : worthRetrying) { if (decaF.matches(itdIsActually, world)) { if (decaF.isRemover()) { @@ -1280,7 +1280,7 @@ class BcelClassWeaver implements IClassWeaver { // for (Iterator iter = itdsForMethodAndConstructor.iterator(); iter.hasNext();) { // BcelTypeMunger methodctorMunger = (BcelTypeMunger) iter.next(); ResolvedMember unMangledInterMethod = methodctorMunger.getSignature(); - List worthRetrying = new ArrayList(); + List worthRetrying = new ArrayList<>(); boolean modificationOccured = false; for (DeclareAnnotation decaMC : decaMCs) { @@ -1306,7 +1306,7 @@ class BcelClassWeaver implements IClassWeaver { while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; - List forRemoval = new ArrayList(); + List forRemoval = new ArrayList<>(); for (DeclareAnnotation decaMC : worthRetrying) { if (decaMC.matches(unMangledInterMethod, world)) { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, methodctorMunger); @@ -1371,7 +1371,7 @@ class BcelClassWeaver implements IClassWeaver { * as well as on the interfieldinit method. */ private boolean weaveDeclareAtField(LazyClassGen clazz) { - List reportedProblems = new ArrayList(); + List reportedProblems = new ArrayList<>(); List allDecafs = world.getDeclareAnnotationOnFields(); if (allDecafs.isEmpty()) { return false; @@ -1389,12 +1389,12 @@ class BcelClassWeaver implements IClassWeaver { List fields = clazz.getFieldGens(); if (fields != null) { - Set unusedDecafs = new HashSet(); + Set unusedDecafs = new HashSet<>(); unusedDecafs.addAll(decafs); for (BcelField field : fields) { if (!field.getName().startsWith(NameMangler.PREFIX)) { // Single first pass - Set worthRetrying = new LinkedHashSet(); + Set worthRetrying = new LinkedHashSet<>(); boolean modificationOccured = false; AnnotationAJ[] dontAddMeTwice = field.getAnnotations(); @@ -1443,7 +1443,7 @@ class BcelClassWeaver implements IClassWeaver { while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; // lets have another go with any remaining ones - List forRemoval = new ArrayList(); + List forRemoval = new ArrayList<>(); for (DeclareAnnotation decaF : worthRetrying) { if (decaF.matches(field, world)) { if (decaF.isRemover()) { @@ -1592,7 +1592,7 @@ class BcelClassWeaver implements IClassWeaver { } private Set findAspectsForMungers(LazyMethodGen mg) { - Set aspectsAffectingType = new HashSet(); + Set aspectsAffectingType = new HashSet<>(); for (BcelShadow shadow : mg.matchedShadows) { for (ShadowMunger munger : shadow.getMungers()) { if (munger instanceof BcelAdvice) { @@ -1611,7 +1611,7 @@ class BcelClassWeaver implements IClassWeaver { private boolean inlineSelfConstructors(List methodGens, List recursiveCtors) { boolean inlinedSomething = false; - List newRecursiveCtors = new ArrayList(); + List newRecursiveCtors = new ArrayList<>(); for (LazyMethodGen methodGen : methodGens) { if (!methodGen.getName().equals("")) { continue; @@ -1783,7 +1783,7 @@ class BcelClassWeaver implements IClassWeaver { // search for 'returns' and make them jump to the // aload_,monitorexit InstructionHandle walker = body.getStart(); - List rets = new ArrayList(); + List rets = new ArrayList<>(); while (walker != null) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); @@ -1984,7 +1984,7 @@ class BcelClassWeaver implements IClassWeaver { // search for 'returns' and make them to the // aload_,monitorexit InstructionHandle walker = body.getStart(); - List rets = new ArrayList(); + List rets = new ArrayList<>(); while (walker != null) { // !walker.equals(body.getEnd())) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); @@ -2101,7 +2101,7 @@ class BcelClassWeaver implements IClassWeaver { // search for 'returns' and make them to the aload_,monitorexit InstructionHandle walker = body.getStart(); - List rets = new ArrayList(); + List rets = new ArrayList<>(); while (walker != null) { // !walker.equals(body.getEnd())) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); @@ -2192,7 +2192,7 @@ class BcelClassWeaver implements IClassWeaver { InstructionList ret = new InstructionList(); InstructionList sourceList = donor.getBody(); - Map srcToDest = new HashMap(); + Map srcToDest = new HashMap<>(); ConstantPool donorCpg = donor.getEnclosingClass().getConstantPool(); ConstantPool recipientCpg = recipient.getEnclosingClass().getConstantPool(); @@ -2296,8 +2296,8 @@ class BcelClassWeaver implements IClassWeaver { } // second pass: retarget branch instructions, copy ranges and tags - Map tagMap = new HashMap(); - Map shadowMap = new HashMap(); + Map tagMap = new HashMap<>(); + Map shadowMap = new HashMap<>(); for (InstructionHandle dest = ret.getStart(), src = sourceList.getStart(); dest != null; dest = dest.getNext(), src = src .getNext()) { Instruction inst = dest.getInstruction(); @@ -2630,7 +2630,7 @@ class BcelClassWeaver implements IClassWeaver { private boolean match(LazyMethodGen mg) { BcelShadow enclosingShadow; - List shadowAccumulator = new ArrayList(); + List shadowAccumulator = new ArrayList<>(); boolean isOverweaving = world.isOverWeaving(); boolean startsAngly = mg.getName().charAt(0) == '<'; // we want to match ajsynthetic constructors... @@ -3040,7 +3040,7 @@ class BcelClassWeaver implements IClassWeaver { */ private ResolvedMember findResolvedMemberNamed(ResolvedType type, String methodName, UnresolvedType[] params) { ResolvedMember[] allMethods = type.getDeclaredMethods(); - List candidates = new ArrayList(); + List candidates = new ArrayList<>(); for (ResolvedMember candidate : allMethods) { if (candidate.getName().equals(methodName)) { if (candidate.getArity() == params.length) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java index 7f6c70d72..70ea191cb 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java @@ -37,7 +37,7 @@ public class BcelGenericSignatureToTypeXConverter { public static ResolvedType classTypeSignature2TypeX(GenericSignature.ClassTypeSignature aClassTypeSignature, GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { - Map typeMap = new HashMap(); + Map typeMap = new HashMap<>(); ResolvedType ret = classTypeSignature2TypeX(aClassTypeSignature, typeParams, world, typeMap); fixUpCircularDependencies(ret, typeMap); return ret; @@ -100,7 +100,7 @@ public class BcelGenericSignatureToTypeXConverter { public static ResolvedType fieldTypeSignature2TypeX(GenericSignature.FieldTypeSignature aFieldTypeSignature, GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { - Map typeMap = new HashMap(); + Map typeMap = new HashMap<>(); ResolvedType ret = fieldTypeSignature2TypeX(aFieldTypeSignature, typeParams, world, typeMap); fixUpCircularDependencies(ret, typeMap); return ret; @@ -133,7 +133,7 @@ public class BcelGenericSignatureToTypeXConverter { public static TypeVariable formalTypeParameter2TypeVariable(GenericSignature.FormalTypeParameter aFormalTypeParameter, GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { - Map typeMap = new HashMap(); + Map typeMap = new HashMap<>(); return formalTypeParameter2TypeVariable(aFormalTypeParameter, typeParams, world, typeMap); } @@ -185,7 +185,7 @@ public class BcelGenericSignatureToTypeXConverter { public static ResolvedType typeSignature2TypeX(GenericSignature.TypeSignature aTypeSig, GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { - Map typeMap = new HashMap(); + Map typeMap = new HashMap<>(); ResolvedType ret = typeSignature2TypeX(aTypeSig, typeParams, world, typeMap); fixUpCircularDependencies(ret, typeMap); return ret; diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java index 6da16be27..08651412c 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java @@ -155,7 +155,7 @@ class BcelMethod extends ResolvedMemberImpl { if (nvPair.getNameString().equals("argNames")) { String argNames = nvPair.getValue().stringifyValue(); StringTokenizer argNameTokenizer = new StringTokenizer(argNames, " ,"); - List argsList = new ArrayList(); + List argsList = new ArrayList<>(); while (argNameTokenizer.hasMoreTokens()) { argsList.add(argNameTokenizer.nextToken()); } @@ -257,7 +257,7 @@ class BcelMethod extends ResolvedMemberImpl { // for testing - use with the method above public String[] getAttributeNames(boolean onlyIncludeAjOnes) { Attribute[] as = method.getAttributes(); - List names = new ArrayList(); + List names = new ArrayList<>(); // String[] strs = new String[as.length]; for (Attribute a : as) { if (!onlyIncludeAjOnes || a.getName().startsWith(AjAttribute.AttributePrefix)) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java index b7ce3f842..3e9ac1b75 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java @@ -113,8 +113,8 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { private boolean isCodeStyleAspect = false; // not redundant with field // above! - private WeakReference superTypeReference = new WeakReference(null); - private WeakReference superInterfaceReferences = new WeakReference(null); + private WeakReference superTypeReference = new WeakReference<>(null); + private WeakReference superInterfaceReferences = new WeakReference<>(null); private int bitflag = 0x0000; @@ -237,7 +237,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { } World world = getResolvedTypeX().getWorld(); supertype = world.resolve(UnresolvedType.forSignature(superclassSignature)); - superTypeReference = new WeakReference(supertype); + superTypeReference = new WeakReference<>(supertype); } return supertype; } @@ -275,7 +275,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { interfaceTypes[i] = getResolvedTypeX().getWorld().resolve(UnresolvedType.forSignature(interfaceSignatures[i])); } } - superInterfaceReferences = new WeakReference(interfaceTypes); + superInterfaceReferences = new WeakReference<>(interfaceTypes); return interfaceTypes; } else { return cachedInterfaceTypes; @@ -386,9 +386,9 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { } catch (RuntimeException re) { throw new RuntimeException("Problem processing attributes in " + javaClass.getFileName(), re); } - List pointcuts = new ArrayList(); - typeMungers = new ArrayList(); - declares = new ArrayList(); + List pointcuts = new ArrayList<>(); + typeMungers = new ArrayList<>(); + declares = new ArrayList<>(); processAttributes(l, pointcuts, false); ReferenceType type = getResolvedTypeX(); AsmManager asmManager = ((BcelWorld) type.getWorld()).getModelAsAsmManager(); @@ -671,7 +671,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { bitflag |= DISCOVERED_ANNOTATION_TARGET_KINDS; annotationTargetKinds = null; // null means we have no idea or the // @Target annotation hasn't been used - List targetKinds = new ArrayList(); + List targetKinds = new ArrayList<>(); if (isAnnotation()) { AnnotationAJ[] annotationsOnThisType = getAnnotations(); for (AnnotationAJ a : annotationsOnThisType) { @@ -770,7 +770,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { // proceeding with resolution. GenericSignature.FormalTypeParameter[] extraFormals = getFormalTypeParametersFromOuterClass(); if (extraFormals.length > 0) { - List allFormals = new ArrayList(); + List allFormals = new ArrayList<>(); for (FormalTypeParameter formalTypeParameter : formalsForResolution) { allFormals.add(formalTypeParameter); } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java index 362c8be9d..61b0bf746 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java @@ -154,7 +154,7 @@ public class BcelShadow extends Shadow { if (mungers.size() > 0) { List src = mungers; if (s.mungers == Collections.EMPTY_LIST) { - s.mungers = new ArrayList(); + s.mungers = new ArrayList<>(); } List dest = s.mungers; for (ShadowMunger shadowMunger : src) { @@ -299,7 +299,7 @@ public class BcelShadow extends Shadow { public void addAdvicePreventingLazyTjp(BcelAdvice advice) { if (badAdvice == null) { - badAdvice = new ArrayList(); + badAdvice = new ArrayList<>(); } badAdvice.add(advice); } @@ -1431,7 +1431,7 @@ public class BcelShadow extends Shadow { if (thisAnnotationVars != null) { return; } - thisAnnotationVars = new HashMap(); + thisAnnotationVars = new HashMap<>(); // populate.. } @@ -1445,7 +1445,7 @@ public class BcelShadow extends Shadow { } targetAnnotationVars = thisAnnotationVars; } else { - targetAnnotationVars = new HashMap(); + targetAnnotationVars = new HashMap<>(); ResolvedType[] rtx = this.getTargetType().resolve(world).getAnnotationTypes(); // what about annotations we havent // gotten yet but we will get in // subclasses? @@ -1549,7 +1549,7 @@ public class BcelShadow extends Shadow { if (kindedAnnotationVars != null) { return; } - kindedAnnotationVars = new HashMap(); + kindedAnnotationVars = new HashMap<>(); ResolvedType[] annotations = null; Member shadowSignature = getSignature(); @@ -1653,7 +1653,7 @@ public class BcelShadow extends Shadow { if (withinAnnotationVars != null) { return; } - withinAnnotationVars = new HashMap(); + withinAnnotationVars = new HashMap<>(); ResolvedType[] annotations = getEnclosingType().resolve(world).getAnnotationTypes(); for (ResolvedType ann : annotations) { @@ -1666,7 +1666,7 @@ public class BcelShadow extends Shadow { if (withincodeAnnotationVars != null) { return; } - withincodeAnnotationVars = new HashMap(); + withincodeAnnotationVars = new HashMap<>(); // For some shadow we are interested in annotations on the method containing that shadow. ResolvedType[] annotations = getEnclosingMethod().getMemberView().getAnnotationTypes(); @@ -1734,7 +1734,7 @@ public class BcelShadow extends Shadow { * @return a list of all the return instructions in the range of this shadow */ private List findReturnInstructions() { - List returns = new ArrayList(); + List returns = new ArrayList<>(); for (InstructionHandle ih = range.getStart(); ih != range.getEnd(); ih = ih.getNext()) { if (ih.getInstruction().isReturnInstruction()) { returns.add(ih); @@ -2187,14 +2187,14 @@ public class BcelShadow extends Shadow { // Parameters are: this if there is one, target if there is one and its different to this, then original arguments // at the shadow, then tjp String extractedShadowMethodName = NameMangler.aroundShadowMethodName(getSignature(), shadowClass.getNewGeneratedNameTag()); - List parameterNames = new ArrayList(); + List parameterNames = new ArrayList<>(); boolean shadowClassIsInterface = shadowClass.isInterface(); LazyMethodGen extractedShadowMethod = extractShadowInstructionsIntoNewMethod(extractedShadowMethodName, shadowClassIsInterface?Modifier.PUBLIC:Modifier.PRIVATE, munger.getSourceLocation(), parameterNames,shadowClassIsInterface); - List argsToCallLocalAdviceMethodWith = new ArrayList(); - List proceedVarList = new ArrayList(); + List argsToCallLocalAdviceMethodWith = new ArrayList<>(); + List proceedVarList = new ArrayList<>(); int extraParamOffset = 0; // Create the extra parameters that are needed for passing to proceed @@ -2845,7 +2845,7 @@ public class BcelShadow extends Shadow { boolean shadowClassIsInterface = getEnclosingClass().isInterface(); LazyMethodGen callbackMethod = extractShadowInstructionsIntoNewMethod( NameMangler.aroundShadowMethodName(getSignature(), getEnclosingClass().getNewGeneratedNameTag()), shadowClassIsInterface?Modifier.PUBLIC:0, - munger.getSourceLocation(), new ArrayList(),shadowClassIsInterface); + munger.getSourceLocation(), new ArrayList<>(),shadowClassIsInterface); BcelVar[] adviceVars = munger.getExposedStateAsBcelVars(true); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java index 60f366e5a..1fb2812bb 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -162,14 +162,14 @@ public class BcelTypeMunger extends ConcreteTypeMunger { thisAspect.getClassName()); Map> declareParentsMap = thisAspectNode.getDeclareParentsMap(); if (declareParentsMap == null) { - declareParentsMap = new HashMap>(); + declareParentsMap = new HashMap<>(); thisAspectNode.setDeclareParentsMap(declareParentsMap); } String tname = target.getName(); String pname = newParent.getName(); List newparents = declareParentsMap.get(tname); if (newparents == null) { - newparents = new ArrayList(); + newparents = new ArrayList<>(); declareParentsMap.put(tname, newparents); } newparents.add(pname); @@ -933,7 +933,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger { } else { annotationsOnRealMember = realMember.getAnnotations(); } - Set addedAnnotations = new HashSet(); + Set addedAnnotations = new HashSet<>(); if (annotationsOnRealMember != null) { for (AnnotationAJ anno : annotationsOnRealMember) { AnnotationGen a = ((BcelAnnotation) anno).getBcelAnnotation(); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java index 41cbf9a7a..a6809f26f 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java @@ -112,8 +112,8 @@ public class BcelWeaver { private boolean inReweavableMode = false; - private transient List addedClasses = new ArrayList(); - private transient List deletedTypenames = new ArrayList(); + private transient List addedClasses = new ArrayList<>(); + private transient List deletedTypenames = new ArrayList<>(); // These four are setup by prepareForWeave private transient List shadowMungerList = null; @@ -244,7 +244,7 @@ public class BcelWeaver { private List addAspectsFromJarFile(File inFile) throws FileNotFoundException, IOException { ZipInputStream inStream = new ZipInputStream(new FileInputStream(inFile)); // ??? buffered - List addedAspects = new ArrayList(); + List addedAspects = new ArrayList<>(); try { while (true) { ZipEntry entry = inStream.getNextEntry(); @@ -286,7 +286,7 @@ public class BcelWeaver { * @throws IOException */ private List addAspectsFromDirectory(File directory) throws FileNotFoundException, IOException { - List addedAspects = new ArrayList(); + List addedAspects = new ArrayList<>(); File[] classFiles = FileUtil.listFiles(directory, new FileFilter() { public boolean accept(File pathname) { return pathname.getName().endsWith(".class"); @@ -350,7 +350,7 @@ public class BcelWeaver { * */ public List addDirectoryContents(File inFile, File outDir) throws IOException { - List addedClassFiles = new ArrayList(); + List addedClassFiles = new ArrayList<>(); // Get a list of all files (i.e. everything that isnt a directory) File[] files = FileUtil.listFiles(inFile, new FileFilter() { @@ -373,7 +373,7 @@ public class BcelWeaver { */ public List addJarFile(File inFile, File outDir, boolean canBeDirectory) { // System.err.println("? addJarFile(" + inFile + ", " + outDir + ")"); - List addedClassFiles = new ArrayList(); + List addedClassFiles = new ArrayList<>(); needToReweaveWorld = true; JarFile inJar = null; @@ -642,7 +642,7 @@ public class BcelWeaver { // across the set of pointcuts.... // Use a map from key based on pc equality, to value based on // pc identity. - Map pcMap = new HashMap(); + Map pcMap = new HashMap<>(); for (ShadowMunger munger: shadowMungers) { Pointcut p = munger.getPointcut(); Pointcut newP = shareEntriesFromMap(p, pcMap); @@ -736,7 +736,7 @@ public class BcelWeaver { if (kindsInCommon != Shadow.NO_SHADOW_KINDS_BITS && couldEverMatchSameJoinPoints(left, right)) { // we know that every branch binds every formal, so there is no // ambiguity if each branch binds it in exactly the same way... - List ambiguousNames = new ArrayList(); + List ambiguousNames = new ArrayList<>(); for (int i = 0; i < numFormals; i++) { if (leftBindings[i] == null) { if (rightBindings[i] != null) { @@ -1011,11 +1011,11 @@ public class BcelWeaver { trace.enter("weave", this, input); } ContextToken weaveToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING, ""); - Collection wovenClassNames = new ArrayList(); + Collection wovenClassNames = new ArrayList<>(); IWeaveRequestor requestor = input.getRequestor(); if (world.getModel() != null && world.isMinimalModel()) { - candidatesForRemoval = new HashSet(); + candidatesForRemoval = new HashSet<>(); } if (world.getModel() != null && !isBatchWeave) { AsmManager manager = world.getModelAsAsmManager(); @@ -1111,7 +1111,7 @@ public class BcelWeaver { // encountered). // For class A, the order is superclasses of A then superinterfaces of A // (and this mechanism is applied recursively) - List typesToProcess = new ArrayList(); + List typesToProcess = new ArrayList<>(); for (Iterator iter = input.getClassFileIterator(); iter.hasNext();) { UnwovenClassFile clf = iter.next(); if (clf.shouldBeWoven()) { @@ -1255,7 +1255,7 @@ public class BcelWeaver { // put out a warning if (world.isInJava5Mode() && world.getLint().adviceDidNotMatch.isEnabled()) { List l = world.getCrosscuttingMembersSet().getShadowMungers(); - Set alreadyWarnedLocations = new HashSet(); + Set alreadyWarnedLocations = new HashSet<>(); for (Object o : l) { ShadowMunger element = (ShadowMunger) o; @@ -1353,7 +1353,7 @@ public class BcelWeaver { Set aspectsPreviouslyInWorld = wsi.getAspectsAffectingType(); // keep track of them just to ensure unique missing aspect error // reporting - Set alreadyConfirmedReweavableState = new HashSet(); + Set alreadyConfirmedReweavableState = new HashSet<>(); for (String requiredTypeSignature : aspectsPreviouslyInWorld) { // for (Iterator iter = aspectsPreviouslyInWorld.iterator(); iter.hasNext();) { // String requiredTypeName = (String) iter.next(); @@ -1480,7 +1480,7 @@ public class BcelWeaver { } onType.clearInterTypeMungers(); - List decpToRepeat = new ArrayList(); + List decpToRepeat = new ArrayList<>(); boolean aParentChangeOccurred = false; boolean anAnnotationChangeOccurred = false; @@ -1504,7 +1504,7 @@ public class BcelWeaver { while ((aParentChangeOccurred || anAnnotationChangeOccurred) && !decpToRepeat.isEmpty()) { anAnnotationChangeOccurred = aParentChangeOccurred = false; - List decpToRepeatNextTime = new ArrayList(); + List decpToRepeatNextTime = new ArrayList<>(); for (DeclareParents decp : decpToRepeat) { boolean typeChanged = applyDeclareParents(decp, onType); if (typeChanged) { @@ -1962,7 +1962,7 @@ public class BcelWeaver { // weaving FastMatchInfo info = new FastMatchInfo(type, null, world); - List result = new ArrayList(); + List result = new ArrayList<>(); if (world.areInfoMessagesEnabled() && world.isTimingEnabled()) { for (ShadowMunger munger : list) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java index 5916e0117..65c3da11a 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java @@ -264,7 +264,7 @@ public class BcelWorld extends World implements Repository { } private static List makeDefaultClasspath(String cp) { - List classPath = new ArrayList(); + List classPath = new ArrayList<>(); classPath.addAll(getPathEntries(cp)); classPath.addAll(getPathEntries(ClassPath.getClassPath())); return classPath; @@ -272,7 +272,7 @@ public class BcelWorld extends World implements Repository { } private static List getPathEntries(String s) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); StringTokenizer tok = new StringTokenizer(s, File.pathSeparator); while (tok.hasMoreTokens()) { ret.add(tok.nextToken()); @@ -880,7 +880,7 @@ public class BcelWorld extends World implements Repository { } onType.clearInterTypeMungers(); - List decpToRepeat = new ArrayList(); + List decpToRepeat = new ArrayList<>(); boolean aParentChangeOccurred = false; boolean anAnnotationChangeOccurred = false; @@ -914,7 +914,7 @@ public class BcelWorld extends World implements Repository { while ((aParentChangeOccurred || anAnnotationChangeOccurred) && !decpToRepeat.isEmpty()) { anAnnotationChangeOccurred = aParentChangeOccurred = false; - List decpToRepeatNextTime = new ArrayList(); + List decpToRepeatNextTime = new ArrayList<>(); for (DeclareParents decp: decpToRepeat) { if (applyDeclareParents(decp, onType)) { aParentChangeOccurred = true; @@ -1063,7 +1063,7 @@ public class BcelWorld extends World implements Repository { } anythingMissing = true; if (aspectRequiredTypes == null) { - aspectRequiredTypes = new HashMap(); + aspectRequiredTypes = new HashMap<>(); } // Record that it has an invalid type reference aspectRequiredTypes.put(aspectName,requiredTypeName); @@ -1112,12 +1112,12 @@ public class BcelWorld extends World implements Repository { return aspectRequiredTypes.containsKey(aspectName); } - private List aspectRequiredTypesProcessed = new ArrayList(); + private List aspectRequiredTypesProcessed = new ArrayList<>(); private Map aspectRequiredTypes = null; public void addAspectRequires(String aspectClassName, String requiredType) { if (aspectRequiredTypes == null) { - aspectRequiredTypes = new HashMap(); + aspectRequiredTypes = new HashMap<>(); } aspectRequiredTypes.put(aspectClassName,requiredType); } @@ -1137,10 +1137,10 @@ public class BcelWorld extends World implements Repository { private int mode; private boolean initialized = false; // Lazily done - private List definitions = new ArrayList(); + private List definitions = new ArrayList<>(); - private List resolvedIncludedAspects = new ArrayList(); - private Map scopes = new HashMap(); + private List resolvedIncludedAspects = new ArrayList<>(); + private Map scopes = new HashMap<>(); // these are not set for LTW mode (exclusion of these fast match patterns is handled before the weaver/world are used) private List includedFastMatchPatterns = Collections.emptyList(); @@ -1180,7 +1180,7 @@ public class BcelWorld extends World implements Repository { public void ensureInitialized() { if (!initialized) { try { - resolvedIncludedAspects = new ArrayList(); + resolvedIncludedAspects = new ArrayList<>(); // Process the definitions into something more optimal for (Definition definition : definitions) { List aspectNames = definition.getAspectClassNames(); @@ -1217,8 +1217,8 @@ public class BcelWorld extends World implements Repository { try { List includePatterns = definition.getIncludePatterns(); if (includePatterns.size() > 0) { - includedPatterns = new ArrayList(); - includedFastMatchPatterns = new ArrayList(); + includedPatterns = new ArrayList<>(); + includedFastMatchPatterns = new ArrayList<>(); } for (String includePattern : includePatterns) { if (includePattern.endsWith("..*")) { @@ -1231,8 +1231,8 @@ public class BcelWorld extends World implements Repository { } List excludePatterns = definition.getExcludePatterns(); if (excludePatterns.size() > 0) { - excludedPatterns = new ArrayList(); - excludedFastMatchPatterns = new ArrayList(); + excludedPatterns = new ArrayList<>(); + excludedFastMatchPatterns = new ArrayList<>(); } for (String excludePattern : excludePatterns) { if (excludePattern.endsWith("..*")) { @@ -1308,7 +1308,7 @@ public class BcelWorld extends World implements Repository { public void addTypeDelegateResolver(TypeDelegateResolver typeDelegateResolver) { if (typeDelegateResolvers == null) { - typeDelegateResolvers = new ArrayList(); + typeDelegateResolvers = new ArrayList<>(); } typeDelegateResolvers.add(typeDelegateResolver); } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java index fa45b7df6..81dde3f58 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java @@ -67,7 +67,7 @@ public class ClassPathManager { // The max number is configured through the property: // org.aspectj.weaver.openarchives // and it defaults to 1000 - private List openArchives = new ArrayList(); + private List openArchives = new ArrayList<>(); static { String openzipsString = getSystemPropertyWithoutSecurityException("org.aspectj.weaver.openarchives", @@ -82,7 +82,7 @@ public class ClassPathManager { if (trace.isTraceEnabled()) { trace.enter("", this, new Object[] { classpath==null?"null":classpath.toString(), handler }); } - entries = new ArrayList(); + entries = new ArrayList<>(); for (String classpathEntry: classpath) { addPath(classpathEntry,handler); } @@ -328,9 +328,9 @@ public class ClassPathManager { static class JImageState { private final String jrtFsPath; private final FileSystem fs; - Map fileCache = new SoftHashMap(); + Map fileCache = new SoftHashMap<>(); boolean packageCacheInitialized = false; - Map packageCache = new HashMap(); + Map packageCache = new HashMap<>(); public JImageState(String jrtFsPath, FileSystem fs) { this.jrtFsPath = jrtFsPath; @@ -516,7 +516,7 @@ public class ClassPathManager { public List getAllClassFiles() throws IOException { ensureOpen(); - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (Enumeration e = zipFile.entries(); e.hasMoreElements();) { ZipEntry entry = e.nextElement(); String name = entry.getName(); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java index c8185d1c2..0eb3cb2b2 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java @@ -126,7 +126,7 @@ public final class LazyClassGen { int highestLineNumber = 0; // ---- JSR 45 info - private final SortedMap inlinedFiles = new TreeMap(); + private final SortedMap inlinedFiles = new TreeMap<>(); private boolean regenerateGenericSignatureAttribute = false; @@ -136,10 +136,10 @@ public final class LazyClassGen { private final World world; private final String packageName = null; - private final List fields = new ArrayList(); - private final List methodGens = new ArrayList(); - private final List classGens = new ArrayList(); - private final List annotations = new ArrayList(); + private final List fields = new ArrayList<>(); + private final List methodGens = new ArrayList<>(); + private final List classGens = new ArrayList<>(); + private final List annotations = new ArrayList<>(); private int childCounter = 0; private final InstructionFactory fact; @@ -818,7 +818,7 @@ public final class LazyClassGen { // non-recursive, may be a bug, ha ha. private List getClassGens() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); ret.add(this); ret.addAll(classGens); return ret; @@ -828,7 +828,7 @@ public final class LazyClassGen { if (classGens.isEmpty()) { return Collections.emptyList(); } - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (LazyClassGen clazz : classGens) { byte[] bytes = clazz.getJavaClass(world).getBytes(); String name = clazz.getName(); @@ -1044,8 +1044,8 @@ public final class LazyClassGen { // // reflective thisJoinPoint support - private Map tjpFields = new HashMap(); - Map annotationCachingFieldCache = new HashMap(); + private Map tjpFields = new HashMap<>(); + Map annotationCachingFieldCache = new HashMap<>(); private int tjpFieldsCounter = -1; // -1 means not yet initialized private int annoFieldsCounter = 0; public static final ObjectType proceedingTjpType = new ObjectType("org.aspectj.lang.ProceedingJoinPoint"); @@ -1254,12 +1254,12 @@ public final class LazyClassGen { } private InstructionList[] initializeAllTjps() { - Vector lists = new Vector(); + Vector lists = new Vector<>(); InstructionList list = initInstructionList(); lists.add(list); - List> entries = new ArrayList>(tjpFields.entrySet()); + List> entries = new ArrayList<>(tjpFields.entrySet()); Collections.sort(entries, new Comparator>() { @Override public int compare(Map.Entry a, Map.Entry b) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java index 97f805273..3ab0c5daf 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -155,7 +155,7 @@ public final class LazyMethodGen implements Traceable { } else { body = null; } - this.attributes = new ArrayList(); + this.attributes = new ArrayList<>(); this.enclosingClass = enclosingClass; assertGoodBody(); this.originalMethodHasLocalVariableTable = true; // it is a new method, we want an lvar table @@ -272,7 +272,7 @@ public final class LazyMethodGen implements Traceable { if (memberView == null) { // If member view is null, we manage them in newAnnotations if (newAnnotations == null) { - newAnnotations = new ArrayList(); + newAnnotations = new ArrayList<>(); } newAnnotations.add(ax); } else { @@ -285,7 +285,7 @@ public final class LazyMethodGen implements Traceable { if (memberView == null) { // If member view is null, we manage them in newAnnotations if (annotationsForRemoval == null) { - annotationsForRemoval = new ArrayList(); + annotationsForRemoval = new ArrayList<>(); } annotationsForRemoval.add(annotationType); } else { @@ -627,7 +627,7 @@ public final class LazyMethodGen implements Traceable { } private class BodyPrinter { - Map labelMap = new HashMap(); + Map labelMap = new HashMap<>(); InstructionList body; PrintStream out; @@ -653,7 +653,7 @@ public final class LazyMethodGen implements Traceable { // label assignment void assignLabels() { - LinkedList exnTable = new LinkedList(); + LinkedList exnTable = new LinkedList<>(); String pendingLabel = null; // boolean hasPendingTargeters = false; int lcounter = 0; @@ -1072,9 +1072,9 @@ public final class LazyMethodGen implements Traceable { */ InstructionHandle oldInstructionHandle = getBody().getStart(); InstructionHandle newInstructionHandle = fresh.getStart(); - LinkedList exceptionList = new LinkedList(); + LinkedList exceptionList = new LinkedList<>(); - Map localVariables = new HashMap(); + Map localVariables = new HashMap<>(); int currLine = -1; int lineNumberOffset = (fromFilename == null) ? 0 : getEnclosingClass().getSourceDebugExtensionOffset(fromFilename); @@ -1198,10 +1198,10 @@ public final class LazyMethodGen implements Traceable { int currLine = -1; int lineNumberOffset = (fromFilename == null) ? 0 : getEnclosingClass().getSourceDebugExtensionOffset(fromFilename); - Map localVariables = new HashMap(); - LinkedList exceptionList = new LinkedList(); - Set forDeletion = new HashSet(); - Set branchInstructions = new HashSet(); + Map localVariables = new HashMap<>(); + LinkedList exceptionList = new LinkedList<>(); + Set forDeletion = new HashSet<>(); + Set branchInstructions = new HashSet<>(); // OPTIMIZE sort out in here: getRange()/insertHandler() and type of // exceptionList while (iHandle != null) { @@ -1333,7 +1333,7 @@ public final class LazyMethodGen implements Traceable { paramSlots = -1; } - Map> duplicatedLocalMap = new HashMap>(); + Map> duplicatedLocalMap = new HashMap<>(); for (LocalVariableTag tag : localVariables.keySet()) { // have we already added one with the same slot number and start // location? @@ -1343,7 +1343,7 @@ public final class LazyMethodGen implements Traceable { InstructionHandle end = (tag.getSlot() < paramSlots ? methodEnd : lvpos.end); Set slots = duplicatedLocalMap.get(start); if (slots == null) { - slots = new HashSet(); + slots = new HashSet<>(); duplicatedLocalMap.put(start, slots); } else if (slots.contains(tag.getSlot())) { // we already have a var starting at this tag with this slot @@ -1461,7 +1461,7 @@ public final class LazyMethodGen implements Traceable { * i.e., a 1:1 mapping. */ private Map copyAllInstructionsExceptRangeInstructionsInto(InstructionList intoList) { - Map map = new HashMap(); + Map map = new HashMap<>(); for (InstructionHandle ih = getBody().getStart(); ih != null; ih = ih.getNext()) { if (Range.isRangeHandle(ih)) { continue; diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java b/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java index c29721d4a..44ac48b9f 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java @@ -69,10 +69,10 @@ public class Utility { public static List readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w, AjAttribute.WeaverVersionInfo version, ConstantPoolReader dataDecompressor) { - List attributes = new ArrayList(); + List attributes = new ArrayList<>(); // first pass, look for version - List forSecondPass = new ArrayList(); + List forSecondPass = new ArrayList<>(); for (int i = as.length - 1; i >= 0; i--) { Attribute a = as[i]; if (a instanceof Unknown) { @@ -248,7 +248,7 @@ public class Utility { // Lookup table, for converting between pairs of types, it gives // us the method name in the Conversions class - private static Hashtable validBoxing = new Hashtable(); + private static Hashtable validBoxing = new Hashtable<>(); static { validBoxing.put("Ljava/lang/Byte;B", "byteObject"); @@ -649,7 +649,7 @@ public class Utility { return Collections.emptyList(); } // Go through the annotation types - List suppressedWarnings = new ArrayList(); + List suppressedWarnings = new ArrayList<>(); boolean found = false; for (int i = 0; !found && i < anns.length; i++) { // Check for the SuppressAjWarnings annotation diff --git a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java index de780156e..81330ed36 100644 --- a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java +++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java @@ -48,15 +48,15 @@ public class Definition { weaverOptions = new StringBuffer(); dumpBefore = false; perClassloaderDumpDir = false; - dumpPatterns = new ArrayList(); - includePatterns = new ArrayList(); - excludePatterns = new ArrayList(); - aspectClassNames = new ArrayList(); - aspectExcludePatterns = new ArrayList(); - aspectIncludePatterns = new ArrayList(); - concreteAspects = new ArrayList(); - scopedAspects = new HashMap(); - requiredTypesForAspects = new HashMap(); + dumpPatterns = new ArrayList<>(); + includePatterns = new ArrayList<>(); + excludePatterns = new ArrayList<>(); + aspectClassNames = new ArrayList<>(); + aspectExcludePatterns = new ArrayList<>(); + aspectIncludePatterns = new ArrayList<>(); + concreteAspects = new ArrayList<>(); + scopedAspects = new HashMap<>(); + requiredTypesForAspects = new HashMap<>(); } public String getWeaverOptions() { @@ -135,10 +135,10 @@ public class Definition { this.extend = extend; } this.precedence = precedence; - this.pointcuts = new ArrayList(); - this.declareAnnotations = new ArrayList(); - this.pointcutsAndAdvice = new ArrayList(); - this.deows = new ArrayList(); + this.pointcuts = new ArrayList<>(); + this.declareAnnotations = new ArrayList<>(); + this.pointcutsAndAdvice = new ArrayList<>(); + this.deows = new ArrayList<>(); this.perclause = perclause; } } diff --git a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java index bfef1244b..cdecd6aaa 100644 --- a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java +++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java @@ -83,7 +83,7 @@ public class DocumentParser extends DefaultHandler { private Definition.ConcreteAspect activeConcreteAspectDefinition; - private static Hashtable parsedFiles = new Hashtable(); + private static Hashtable parsedFiles = new Hashtable<>(); private static boolean CACHE; private static final boolean LIGHTPARSER; diff --git a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java index 09a9df96f..e93bc896c 100644 --- a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java +++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java @@ -25,7 +25,7 @@ public class LightXMLParser { private char pushedBackChar; private Reader reader; - private static Map entities = new HashMap(); + private static Map entities = new HashMap<>(); static { entities.put("amp", new char[] { '&' }); @@ -37,7 +37,7 @@ public class LightXMLParser { public LightXMLParser() { this.name = null; - this.attributes = new HashMap(); + this.attributes = new HashMap<>(); this.children = new ArrayList(); } @@ -51,7 +51,7 @@ public class LightXMLParser { public void parseFromReader(Reader reader) throws Exception { this.pushedBackChar = NULL_CHAR; - this.attributes = new HashMap(); + this.attributes = new HashMap<>(); this.name = null; this.children = new ArrayList(); this.reader = reader; diff --git a/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java index 7df7f438c..80cfb6de7 100644 --- a/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java +++ b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java @@ -404,7 +404,7 @@ public class AsmRelationshipProvider { IProgramElement root = model.getHierarchy().getRoot(); IProgramElement binaries = model.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries"); if (binaries == null) { - binaries = new ProgramElement(model, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList()); + binaries = new ProgramElement(model, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList<>()); root.addChild(binaries); } // if (aspect.getPackageName() != null) { @@ -413,7 +413,7 @@ public class AsmRelationshipProvider { IProgramElement pkgNode = model.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename); // note packages themselves have no source location if (pkgNode == null) { - pkgNode = new ProgramElement(model, packagename, IProgramElement.Kind.PACKAGE, new ArrayList()); + pkgNode = new ProgramElement(model, packagename, IProgramElement.Kind.PACKAGE, new ArrayList<>()); binaries.addChild(pkgNode); pkgNode.addChild(classFileNode); } else { @@ -539,7 +539,7 @@ public class AsmRelationshipProvider { IProgramElement root = asm.getHierarchy().getRoot(); IProgramElement binaries = asm.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries"); if (binaries == null) { - binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList()); + binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList<>()); root.addChild(binaries); } // if (aspect.getPackageName() != null) { @@ -548,7 +548,7 @@ public class AsmRelationshipProvider { IProgramElement pkgNode = asm.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename); // note packages themselves have no source location if (pkgNode == null) { - pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList()); + pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList<>()); binaries.addChild(pkgNode); pkgNode.addChild(classFileNode); } else { @@ -764,7 +764,7 @@ public class AsmRelationshipProvider { if (ts == null) { pe.setParameterSignatures(Collections.emptyList(), Collections.emptyList()); } else { - List paramSigs = new ArrayList(); + List paramSigs = new ArrayList<>(); for (UnresolvedType t : ts) { paramSigs.add(t.getSignature().toCharArray()); } @@ -783,7 +783,7 @@ public class AsmRelationshipProvider { private static void setParentTypesOnDeclareParentsNode(DeclareParents decp, IProgramElement decpElement) { TypePatternList tpl = decp.getParents(); - List parents = new ArrayList(); + List parents = new ArrayList<>(); for (int i = 0; i < tpl.size(); i++) { parents.add(tpl.get(i).getExactType().getName().replaceAll("\\$", ".")); } diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java b/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java index 30983e38f..74477d143 100644 --- a/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java +++ b/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java @@ -32,7 +32,7 @@ import org.aspectj.weaver.World; public class JavaLangTypeToResolvedTypeConverter { // Used to prevent recursion - we record what we are working on and return it if asked again *whilst* working on it - private Map typeVariablesInProgress = new HashMap(); + private Map typeVariablesInProgress = new HashMap<>(); private final World world; public JavaLangTypeToResolvedTypeConverter(World aWorld) { diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java b/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java index 5bb0fd80d..d3a194fcc 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java @@ -91,7 +91,7 @@ public class WeavingAdaptor implements IMessageContext { private WeavingAdaptorMessageHolder messageHolder; private boolean abortOnError = false; protected GeneratedClassHandler generatedClassHandler; - protected Map generatedClasses = new HashMap(); + protected Map generatedClasses = new HashMap<>(); public BcelObjectType delegateForCurrentClass; // lazily initialized, should be used to prevent parsing bytecode multiple // times protected ProtectionDomain activeProtectionDomain; @@ -138,7 +138,7 @@ public class WeavingAdaptor implements IMessageContext { } protected List getFullClassPath(ClassLoader loader) { - List list = new LinkedList(); + List list = new LinkedList<>(); for (; loader != null; loader = loader.getParent()) { if (loader instanceof URLClassLoader) { URL[] urls = ((URLClassLoader) loader).getURLs(); @@ -165,7 +165,7 @@ public class WeavingAdaptor implements IMessageContext { } private List getFullAspectPath(ClassLoader loader) { - List list = new LinkedList(); + List list = new LinkedList<>(); for (; loader != null; loader = loader.getParent()) { if (loader instanceof WeavingClassLoader) { URL[] urls = ((WeavingClassLoader) loader).getAspectURLs(); @@ -602,7 +602,7 @@ public class WeavingAdaptor implements IMessageContext { } private static List makeClasspath(String cp) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); if (cp != null) { StringTokenizer tok = new StringTokenizer(cp, File.pathSeparator); while (tok.hasMoreTokens()) { @@ -723,7 +723,7 @@ public class WeavingAdaptor implements IMessageContext { public void flushMessages() { if (savedMessages == null) { - savedMessages = new ArrayList(); + savedMessages = new ArrayList<>(); savedMessages.addAll(super.getUnmodifiableListView()); clearMessages(); for (IMessage message : savedMessages) { @@ -794,7 +794,7 @@ public class WeavingAdaptor implements IMessageContext { @Override public List getUnmodifiableListView() { // System.err.println("? WeavingAdaptorMessageHolder.getUnmodifiableListView() savedMessages=" + savedMessages); - List allMessages = new ArrayList(); + List allMessages = new ArrayList<>(); allMessages.addAll(savedMessages); allMessages.addAll(super.getUnmodifiableListView()); return allMessages; @@ -803,7 +803,7 @@ public class WeavingAdaptor implements IMessageContext { protected class WeavingAdaptorMessageWriter extends MessageWriter { - private final Set ignoring = new HashSet(); + private final Set ignoring = new HashSet<>(); private final IMessage.Kind failKind; public WeavingAdaptorMessageWriter(PrintWriter writer) { @@ -859,7 +859,7 @@ public class WeavingAdaptor implements IMessageContext { private class WeavingClassFileProvider implements IClassFileProvider { private final UnwovenClassFile unwovenClass; - private final List unwovenClasses = new ArrayList(); + private final List unwovenClasses = new ArrayList<>(); private IUnwovenClassFile wovenClass; private boolean isApplyAtAspectJMungersOnly = false; diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java index 1580277b1..cb05b10e0 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java @@ -59,7 +59,7 @@ public abstract class AbstractIndexedFileCacheBacking extends AbstractFileCacheB return EMPTY_KEYS; } - Collection matches=new LinkedList(); + Collection matches= new LinkedList<>(); synchronized(index) { for (String key : index.keySet()) { if (key.matches(regex)) { @@ -96,7 +96,7 @@ public abstract class AbstractIndexedFileCacheBacking extends AbstractFileCacheB protected abstract Map getIndex (); protected Map readIndex (File cacheDir, File cacheFile) { - Map indexMap=new TreeMap(); + Map indexMap= new TreeMap<>(); IndexEntry[] idxValues=readIndex(cacheFile); if (LangUtil.isEmpty(idxValues)) { if ((logger != null) && logger.isTraceEnabled()) { diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java index 636a82a7a..bc0b678f4 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java @@ -50,7 +50,7 @@ import org.aspectj.weaver.tools.TraceFactory; * The actual persistence is implemented by the concrete classes */ public abstract class AsynchronousFileCacheBacking extends AbstractIndexedFileCacheBacking { - private static final BlockingQueue commandsQ=new LinkedBlockingQueue(); + private static final BlockingQueue commandsQ= new LinkedBlockingQueue<>(); private static final ExecutorService execService=Executors.newSingleThreadExecutor(); private static Future commandsRunner; @@ -180,7 +180,7 @@ public abstract class AsynchronousFileCacheBacking extends AbstractIndexedFileCa if (index.isEmpty()) { return Collections.emptyList(); } else { - return new ArrayList(index.values()); + return new ArrayList<>(index.values()); } } } diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java index 44728d041..b9031cbae 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java @@ -49,7 +49,7 @@ public class DefaultCacheKeyResolver implements CacheKeyResolver { public String createClassLoaderScope(ClassLoader cl, List aspects) { String name = cl != null ? cl.getClass().getSimpleName() : "unknown"; - List hashableStrings = new LinkedList(); + List hashableStrings = new LinkedList<>(); StringBuilder hashable = new StringBuilder(256); // Add the list of loader urls to the hash list diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java index 6de416a80..e5f45f92c 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java @@ -57,7 +57,7 @@ public class FlatFileCacheBacking extends AsynchronousFileCacheBacking { } protected Map readClassBytes (Map indexMap, File[] files) { - Map result=new TreeMap(); + Map result= new TreeMap<>(); if (LangUtil.isEmpty(files)) { return result; } diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java index 8e18dadde..c5c079dcf 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java @@ -78,7 +78,7 @@ public class WeavedClassCache { private final CacheKeyResolver resolver; private final String name; - private static final List cacheRegistry = new LinkedList(); + private static final List cacheRegistry = new LinkedList<>(); protected WeavedClassCache(GeneratedClassHandler existingClassHandler, IMessageHandler messageHandler, @@ -259,7 +259,7 @@ public class WeavedClassCache { */ public static List getCaches() { synchronized (cacheRegistry) { - return new LinkedList(cacheRegistry); + return new LinkedList<>(cacheRegistry); } } diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java index 6ee8b728c..fa7fba074 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java @@ -156,7 +156,7 @@ public class ZippedFileCacheBacking extends AsynchronousFileCacheBacking { e); } - entriesMap = new TreeMap(); + entriesMap = new TreeMap<>(); okEntries = false; } @@ -196,7 +196,7 @@ public class ZippedFileCacheBacking extends AsynchronousFileCacheBacking { } if (toDelete == null) { - toDelete = new TreeSet(); + toDelete = new TreeSet<>(); } toDelete.add(key); } @@ -259,7 +259,7 @@ public class ZippedFileCacheBacking extends AsynchronousFileCacheBacking { return Collections.emptyMap(); } - Map result=new TreeMap(); + Map result= new TreeMap<>(); byte[] copyBuf=new byte[4096]; ByteArrayOutputStream out=new ByteArrayOutputStream(copyBuf.length); ZipFile zipFile=new ZipFile(file); diff --git a/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java b/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java index ad384fa49..c4d8efa80 100644 --- a/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java @@ -78,29 +78,29 @@ public class JoinPointSignatureIteratorTest extends TestCase { public static Map> expectedResults = new HashMap<>(); static { - List sigs = new ArrayList(); + List sigs = new ArrayList<>(); sigs.add("java.lang.Object $Proxy1.get1(java.io.Serializable)"); sigs.add("java.lang.Object MessageService.get1(java.io.Serializable)"); sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)"); sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)"); expectedResults.put("java.lang.Object $Proxy1.get1(java.io.Serializable)", sigs); - sigs = new ArrayList(); + sigs = new ArrayList<>(); sigs.add("java.lang.Object $Proxy1.get2(java.io.Serializable)"); sigs.add("java.lang.Object MessageService.get2(java.io.Serializable)"); sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)"); sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)"); expectedResults.put("java.lang.Object $Proxy1.get2(java.io.Serializable)", sigs); - sigs = new ArrayList(); + sigs = new ArrayList<>(); sigs.add("java.lang.Object $Proxy1.get1(java.lang.Long)"); expectedResults.put("java.lang.Object $Proxy1.get1(java.lang.Long)", sigs); - sigs = new ArrayList(); + sigs = new ArrayList<>(); sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)"); expectedResults.put("java.lang.Object GenericService.get1(java.io.Serializable)", sigs); - sigs = new ArrayList(); + sigs = new ArrayList<>(); sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)"); expectedResults.put("java.lang.Object GenericService.get2(java.io.Serializable)", sigs); } diff --git a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java index d4ed852d2..2c99ee29f 100644 --- a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java @@ -83,7 +83,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable01() { List list = new ArrayList(); - List listOfString = new ArrayList(); + List listOfString = new ArrayList<>(); List listOfSomething = new ArrayList(); List listOfSomethingNumberish = new ArrayList(); List listOfSomethingSuperDouble = new ArrayList(); @@ -192,7 +192,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable02() { List list = new ArrayList(); ArrayList arraylist = null; - List listOfString = new ArrayList(); + List listOfString = new ArrayList<>(); List listOfSomething = new ArrayList(); ArrayList arrayListOfSomething = null; List listOfNumber = null; @@ -200,7 +200,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList arrayListOfSomethingNumberish = null; List listOfSomethingNumberish = new ArrayList(); List listOfSomethingSuperDouble = new ArrayList(); - List listOfInteger = new ArrayList(); + List listOfInteger = new ArrayList<>(); ArrayList arrayListOfString; ArrayList arraylistOfInteger; // interfaces too List @@ -275,7 +275,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable03_method_m2() { List list = new ArrayList(); ArrayList arraylist = null; - List listOfString = new ArrayList(); + List listOfString = new ArrayList<>(); List listOfSomething = new ArrayList(); ArrayList arrayListOfSomething = null; List listOfNumber = null; @@ -284,7 +284,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList arrayListOfSomethingNumberish = null; List listOfSomethingNumberish = new ArrayList(); List listOfSomethingSuperDouble = new ArrayList(); - List listOfInteger = new ArrayList(); + List listOfInteger = new ArrayList<>(); ArrayList arrayListOfString; ArrayList arraylistOfInteger; // interfaces too List @@ -362,7 +362,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable04_method_m3() { List list = new ArrayList(); ArrayList arraylist = null; - List listOfString = new ArrayList(); + List listOfString = new ArrayList<>(); List listOfSomething = new ArrayList(); ArrayList arrayListOfSomething = null; List listOfNumber = null; @@ -371,7 +371,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList arrayListOfSomethingNumberish = null; List listOfSomethingNumberish = new ArrayList(); List listOfSomethingSuperDouble = new ArrayList(); - List listOfInteger = new ArrayList(); + List listOfInteger = new ArrayList<>(); ArrayList arrayList = null; ArrayList arrayListOfString; ArrayList arraylistOfInteger; @@ -478,7 +478,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable03_method_m4() { List list = new ArrayList(); ArrayList arraylist = null; - List listOfString = new ArrayList(); + List listOfString = new ArrayList<>(); List listOfSomething = new ArrayList(); ArrayList arrayListOfSomething = null; List listOfNumber = null; @@ -486,7 +486,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList arrayListOfSomethingNumberish = null; List listOfSomethingNumberish = new ArrayList(); List listOfSomethingSuperDouble = new ArrayList(); - List listOfInteger = new ArrayList(); + List listOfInteger = new ArrayList<>(); ArrayList arrayListOfString; ArrayList arraylistOfInteger; // interfaces too List @@ -564,7 +564,7 @@ public class ReferenceTypeTestCase extends TestCase { // copy of the real one in BcelClassWeaver public static class IfaceInitList implements PartialOrder.PartialComparable { final ResolvedType onType; - List list = new ArrayList(); + List list = new ArrayList<>(); IfaceInitList(ResolvedType onType) { this.onType = onType; diff --git a/weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java b/weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java index eddcd146d..f8eaa4c9d 100644 --- a/weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java @@ -26,7 +26,7 @@ public class WeaverMessagesTestCase extends TestCase { Class wmClass = WeaverMessages.class; Field[] fields = wmClass.getDeclaredFields(); - List fieldList = new ArrayList(); + List fieldList = new ArrayList<>(); for (Field f : fields) { if (f.getType() == String.class) { try { diff --git a/weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java index 4e24bb555..a5684db18 100644 --- a/weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java @@ -60,7 +60,7 @@ public class MegaZipTestCase extends WeaveTestCase { } public List getShadowMungers() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); ret.add(makeConcreteAdvice("before" + "(): call(* *.println(..)) -> static void fluffy.Aspect.before_method_call()")); ret.add(makeConcreteAdvice("afterReturning" + "(): call(* *.println(..)) -> static void fluffy.Aspect.afterReturning_method_call()")); diff --git a/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java index 6e69e2c0f..f547d6afd 100644 --- a/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java @@ -84,7 +84,7 @@ public abstract class WeaveTestCase extends TestCase { } public void weaveTest(String name, String outName, ShadowMunger planner) throws IOException { - List l = new ArrayList(1); + List l = new ArrayList<>(1); l.add(planner); weaveTest(name, outName, l); } @@ -215,7 +215,7 @@ public abstract class WeaveTestCase extends TestCase { } public List makeAdviceAll(String kind, boolean matchOnlyPrintln) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); if (matchOnlyPrintln) { ret.add(makeConcreteAdvice(kind + "(): call(* *.println(..)) -> static void Aspect.ajc_" + kind + "_method_execution()")); } else { diff --git a/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java index 8e84a71e5..eb5c50948 100644 --- a/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java @@ -93,7 +93,7 @@ public class AnnotationPatternMatchingTestCase extends TestCase { } static class MyMessageHandler implements IMessageHandler { - public List messages = new ArrayList(); + public List messages = new ArrayList<>(); public boolean handleMessage(IMessage message) throws AbortException { messages.add(message); diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java index f65053f7e..5181efcf6 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java @@ -140,7 +140,7 @@ public class Java15PointcutExpressionTest extends TestCase { } - private static final Set DEFAULT_SUPPORTED_PRIMITIVES = new HashSet(); + private static final Set DEFAULT_SUPPORTED_PRIMITIVES = new HashSet<>(); static { DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION); @@ -286,7 +286,7 @@ public class Java15PointcutExpressionTest extends TestCase { tps[parameterNumber].getAnnotationPattern().toString(); // parameter type annotation checking - Set expected = new HashSet(); + Set expected = new HashSet<>(); expected.addAll(mpnv.getParameterTypeAnnotations()); StringTokenizer st = new StringTokenizer(expectedParameterTypeAnnotations==null?"":expectedParameterTypeAnnotations); @@ -305,7 +305,7 @@ public class Java15PointcutExpressionTest extends TestCase { } // parameter annotation checking - expected = new HashSet(); + expected = new HashSet<>(); expected.addAll(mpnv.getParameterAnnotations()); st = new StringTokenizer(expectedParameterAnnotations==null?"":expectedParameterAnnotations); @@ -327,8 +327,8 @@ public class Java15PointcutExpressionTest extends TestCase { static class MyPatternNodeVisitor extends AbstractPatternNodeVisitor { private StringBuffer stringRep = new StringBuffer(); - private List parameterAnnotations = new ArrayList(); - private List parameterTypeAnnotations = new ArrayList(); + private List parameterAnnotations = new ArrayList<>(); + private List parameterTypeAnnotations = new ArrayList<>(); public String getStringRepresentation() { return stringRep.toString(); } public List getParameterAnnotations() { return parameterAnnotations; } diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java index fbf4d3068..46f841666 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java @@ -87,7 +87,7 @@ public class PointcutParserTest extends TestCase { .getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(p, this.getClass() .getClassLoader()); assertEquals("Should use the set we pass in", p, parser.getSupportedPrimitives()); - Set q = new HashSet(); + Set q = new HashSet<>(); q.add(PointcutPrimitive.ARGS); parser = PointcutParser.getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(q, this .getClass().getClassLoader()); diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java index 7d1b66407..a6445057b 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java @@ -137,7 +137,7 @@ public abstract class AsynchronousFileCacheBackingTestSupport return Collections.emptyMap(); } - Map files=new TreeMap(); + Map files= new TreeMap<>(); for (IndexEntry entry : entries) { File file=createDataFile(entry); if (file != null) { diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java index 87daff796..3271a1ffa 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java @@ -74,7 +74,7 @@ public class FlatFileCacheBackingTest extends AsynchronousFileCacheBackingTestSu long newCrc = generateNewBytes(); assertTrue("Bad new CRC", newCrc != (-1L)); - Map badFiles = new TreeMap(); + Map badFiles = new TreeMap<>(); for (IndexEntry entry : entries) { String key = entry.key; if (key.startsWith("badData")) { @@ -116,7 +116,7 @@ public class FlatFileCacheBackingTest extends AsynchronousFileCacheBackingTestSu File indexFile = getIndexFile(); writeIndex(indexFile, entries); - Map dataFiles = new TreeMap(); + Map dataFiles = new TreeMap<>(); for (IndexEntry entry : entries) { String key = entry.key; if (key.startsWith("withData")) { diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java index a02400eb8..9d256d576 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java @@ -33,11 +33,11 @@ public class WeavedClassCacheTest extends AbstractCacheBackingTestSupport { } public class MemoryCacheBacking implements CacheBacking { - HashMap cache = new HashMap(); + HashMap cache = new HashMap<>(); public String[] getKeys(String regex) { Set keys = cache.keySet(); - List matches = new LinkedList(); + List matches = new LinkedList<>(); for (String key : keys) { if (key.matches(regex)) { matches.add(key); @@ -86,7 +86,7 @@ public class WeavedClassCacheTest extends AbstractCacheBackingTestSupport { public class TestGeneratedClassHandler implements GeneratedClassHandler { public int accepts = 0; - public List classesISaw = new LinkedList(); + public List classesISaw = new LinkedList<>(); public void acceptClass (String name, byte[] originalBytes, byte[] wovenBytes) { accepts++; diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java index 4c41c1807..eee9aa32b 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java @@ -40,7 +40,7 @@ public class ZippedFileCacheBackingTest extends AsynchronousFileCacheBackingTest File indexFile=getIndexFile(); writeIndex(indexFile, entries); - Map entriesMap=new TreeMap(); + Map entriesMap= new TreeMap<>(); for (IndexEntry ie : entries) { if (ie.ignored) { continue; @@ -73,7 +73,7 @@ public class ZippedFileCacheBackingTest extends AsynchronousFileCacheBackingTest } public void testReadWriteZipClassBytes () throws IOException { - Map entriesMap=new TreeMap(); + Map entriesMap= new TreeMap<>(); for (int index=0; index < Byte.SIZE; index++) { String name="classBytes#" + index; random.nextBytes(bytes); @@ -104,7 +104,7 @@ public class ZippedFileCacheBackingTest extends AsynchronousFileCacheBackingTest long newCrc=generateNewBytes(); assertTrue("Bad new CRC", newCrc != (-1L)); - Map entriesMap=new TreeMap(); + Map entriesMap= new TreeMap<>(); for (IndexEntry ie : entries) { if (ie.ignored) { continue;