diff options
243 files changed, 1046 insertions, 1046 deletions
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<String> configFiles = new ArrayList<String>(); + private List<String> configFiles = new ArrayList<>(); private JavaBuildOptions javaBuildOptions; public static BrowserManager getDefault() { @@ -182,7 +182,7 @@ public class BrowserManager { } private List<String> getConfigFilesList(String[] configFiles) { - List<String> configs = new ArrayList<String>(); + List<String> 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<File> getAllOutputLocations() { - List<File> outputDirs = new ArrayList<File>(); + List<File> 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<IMessage> messages; public BrowserMessageHandler() { - ignoring = new ArrayList<IMessage.Kind>(); - messages = new ArrayList<IMessage>(); + 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<EditorListener> editorListeners = new ArrayList<EditorListener>(); - private Vector<EditorAdapter> editors = new Vector<EditorAdapter>(); + private ArrayList<EditorListener> editorListeners = new ArrayList<>(); + private Vector<EditorAdapter> 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<String,String> getDefaultJavaOptions() { if (defaultOptionsMap != null) return defaultOptionsMap; - defaultOptionsMap = new HashMap<String,String>(); + 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<String> configClasspath = config.getClasspath(); - ArrayList<String> toAdd = new ArrayList<String>(); + ArrayList<String> 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<String> both = new ArrayList<String>(configClasspath.size() + toAdd.size()); + ArrayList<String> 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<String> tokens = new ArrayList<String>(); + List<String> 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<String> tokenizeString(String str) { - List<String> tokens = new ArrayList<String>(); + List<String> 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<String> getSourceFileList(String[] files) { - List<String> sourceFiles = new ArrayList<String>(); + List<String> 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<String> messagesReceived = new ArrayList<String>(); + private List<String> 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<String, String> javaOptions; private String nonStandardOptions; - private List<String> projectSourceFiles = new ArrayList<String>(); + private List<String> projectSourceFiles = new ArrayList<>(); private Map<String, File> sourcePathResources; private String srcDirName = "src"; @@ -76,7 +76,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { public Map<String, String> getJavaOptionsMap() { if (javaOptions == null) { - javaOptions = new Hashtable<String, String>(); + 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<String, File> getSourcePathResources() { if (sourcePathResources == null) { - sourcePathResources = new HashMap<String, File>(); + 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<TestMessage> errors; public TestMessageHandler() { - ignoring = new ArrayList<Kind>(); - messages = new ArrayList<TestMessage>(); - errors = new ArrayList<TestMessage>(); + 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<File> getAllOutputLocations() { if (allOutputLocations == null) { - allOutputLocations = new ArrayList<File>(); + 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<File> aspects = new HashSet<File>(); + Set<File> aspects = new HashSet<>(); compilerConfig.setAspectPath(aspects); AjBuildConfig buildConfig = genAjBuildConfig(); List<File> aPath = buildConfig.getAspectpath(); @@ -83,7 +83,7 @@ public class AjConfigTest extends AjdeCoreTestCase { } public void testInpath() { - Set<File> jars = new HashSet<File>(); + Set<File> jars = new HashSet<>(); compilerConfig.setInpath(jars); AjBuildConfig buildConfig = genAjBuildConfig(); List<File> inJars = buildConfig.getInpath(); @@ -130,7 +130,7 @@ public class AjConfigTest extends AjdeCoreTestCase { } public void testSourcePathResources() { - Map<String, File> m = new HashMap<String, File>(); + Map<String, File> 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<File> injars = new HashSet<File>(); + Set<File> injars = new HashSet<>(); injars.add(openFile(injarName)); compilerConfig.setInpath(injars); - Set<File> aspectpath = new HashSet<File>(); + Set<File> 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<File> inpath = new HashSet<File>(); + Set<File> 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<String> expectedOutputJarContents = new HashSet<String>(); + Set<String> 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<File> inpath = new HashSet<File>(); + Set<File> 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<String> expectedBindirContents = new HashSet<String>(); + Set<String> 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<File> inpath = new HashSet<File>(); + Set<File> 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<String> expectedOutputJarContents = new HashSet<String>(); + Set<String> expectedOutputJarContents = new HashSet<>(); // From indir1 expectedOutputJarContents.add("example/HelloWorld.class"); @@ -181,7 +181,7 @@ public class InpathTest extends AjdeCoreTestCase { * */ public void testInpathAndInjarToBin() { - Set<File> inpath = new HashSet<File>(); + Set<File> 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<String> expectedBindirContents = new HashSet<String>(); + Set<String> 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<File> roots = new HashSet<File>(); + Set<File> 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<File> injars = new HashSet<File>(); + Set<File> 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<File> injars = new HashSet<File>(); + Set<File> 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<File> injars = new HashSet<File>(); + Set<File> 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<File> injars = new HashSet<File>(); + Set<File> 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<File> paths = new HashSet<>(); paths.add(openFile(binDir)); compilerConfig.setInpath(paths); - compilerConfig.setProjectSourceFiles(new ArrayList<String>()); + 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<File> paths = new HashSet<>(); paths.add(openFile(binDir)); compilerConfig.setInpath(paths); - compilerConfig.setProjectSourceFiles(new ArrayList<String>()); + 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<File> inpath = new HashSet<File>(); + Set<File> inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set<File> aspectpath = new HashSet<File>(); + Set<File> 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<File> inpath = new HashSet<File>(); + Set<File> inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set<File> aspectpath = new HashSet<File>(); + Set<File> 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<File> inpath = new HashSet<File>(); + Set<File> inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set<File> aspectpath = new HashSet<File>(); + Set<File> 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<File> inpath = new HashSet<File>(); + Set<File> inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set<File> aspectpath = new HashSet<File>(); + Set<File> 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<File> inpath = new HashSet<File>(); + Set<File> inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set<File> aspectpath = new HashSet<File>(); + Set<File> 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<File> inpath = new HashSet<File>(); + Set<File> inpath = new HashSet<>(); inpath.add(openFile("Simple.jar")); compilerConfig.setInpath(inpath); - Set<File> aspectpath = new HashSet<File>(); + Set<File> 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<File> inpath = new HashSet<File>(); + Set<File> inpath = new HashSet<>(); inpath.add(openFile("Simple_nodebug.jar")); compilerConfig.setInpath(inpath); - Set<File> aspectpath = new HashSet<File>(); + Set<File> 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<File> inpath = new HashSet<File>(); + Set<File> inpath = new HashSet<>(); inpath.add(openFile("Simple_nodebug.jar")); compilerConfig.setInpath(inpath); - Set<File> aspectpath = new HashSet<File>(); + Set<File> 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<File> inpath = new HashSet<File>(); + Set<File> inpath = new HashSet<>(); inpath.add(openFile("Simple_nodebug.jar")); compilerConfig.setInpath(inpath); - Set<File> aspectpath = new HashSet<File>(); + Set<File> 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<File> importedFiles = new ArrayList<File>(); - private List<String> problemEntries = new ArrayList<String>(); + private List<File> importedFiles = new ArrayList<>(); + private List<String> 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<String> fileContents = new ArrayList<String>(); + List<String> 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<File> files = configParser.getFiles(); - List<String> relativeFiles = new ArrayList<String>(); + List<String> relativeFiles = new ArrayList<>(); for (File file : files) { relativeFiles.add(relativizePath(file.getPath(), rootPath)); } return relativeFiles; } catch (ConfigParser.ParseException pe) { - return new ArrayList<String>(); + 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<String> allBuildConfigFiles; - private List<BuildConfigListener> listeners = new ArrayList<BuildConfigListener>(); + private List<BuildConfigListener> 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<File> configFiles = new ArrayList<File>(); - List<File> importedFiles = new ArrayList<File>(); + List<File> configFiles = new ArrayList<>(); + List<File> importedFiles = new ArrayList<>(); List<String> badEntries = null; try { LstBuildConfigFileParser configParser = new LstBuildConfigFileParser(configFilePath); @@ -134,7 +134,7 @@ public class LstBuildConfigManager implements BuildConfigManager { } private List<String> relativizeFilePaths(List<File> configFiles, String rootPath) { - List<String> relativePathsList = new ArrayList<String>(); + List<String> 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<String> getAllBuildConfigFiles() { if (allBuildConfigFiles == null) { - allBuildConfigFiles = new ArrayList<String>(); + 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<BuildConfigNode> getActiveNodes(BuildConfigNode.Kind kind) { - List<BuildConfigNode> nodes = new ArrayList<BuildConfigNode>(); + List<BuildConfigNode> 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<BuildConfigNode> children = new ArrayList<BuildConfigNode>(); + protected List<BuildConfigNode> 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<BuildConfigNode>(); + 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<BuildConfigNode>(); + 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<String> debug = null; if (javaOptionToSet.equals(JavaOptions.PRESERVE_ALL_LOCALS)) { - debug = new JComboBox<String>(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<String>(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<String> visibleFileList = new ArrayList<String>(); + static List<String> 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<IProgramElement> pointcuts = new ArrayList<IProgramElement>(); - List<IProgramElement> advice = new ArrayList<IProgramElement>(); - List<IProgramElement> declares = new ArrayList<IProgramElement>(); + List<IProgramElement> pointcuts = new ArrayList<>(); + List<IProgramElement> advice = new ArrayList<>(); + List<IProgramElement> declares = new ArrayList<>(); List<IProgramElement> 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<String>(); - ajcOptions = new Vector<String>(); - filenames = new Vector<String>(); - fileList = new Vector<String>(); - packageList = new Vector<String>(); + options = new Vector<>(); + ajcOptions = new Vector<>(); + filenames = new Vector<>(); + fileList = new Vector<>(); + packageList = new Vector<>(); docModifier = "package"; - sourcepath = new Vector<String>(); + 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<String> dirList = new ArrayList<String>(); + ArrayList<String> 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<String> files = new ArrayList<String>(); + List<String> 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<String>(); + options = new Vector<>(); for (String a: javadocargs) { options.add(a); } @@ -362,7 +362,7 @@ public class Main implements Config { } static Vector<String> getSourcePath() { - Vector<String> sourcePath = new Vector<String>(); + Vector<String> 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<String> argList = new ArrayList<String>(); + List<String> argList = new ArrayList<>(); while (st.hasMoreElements()) { argList.add(st.nextToken()); } @@ -490,7 +490,7 @@ public class Main implements Config { ioe.printStackTrace(); } } - List<String> vargs = new LinkedList<String>(Arrays.asList(args)); + List<String> 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<String> result = new LinkedList<String>(); + List<String> 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<String> getTargets(IProgramElement node, IRelationship.Kind kind, String relName) { - List<IRelationship> relations = new ArrayList<IRelationship>(); + List<IRelationship> relations = new ArrayList<>(); List<IRelationship> 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<String> targets = new ArrayList<String>(); + List<String> targets = new ArrayList<>(); for (IRelationship rtn : relations) { if (rtn.getKind().equals(kind) && ((relName != null && relName.equals(rtn.getName())) || relName == null)) { List<String> targs = rtn.getTargets(); @@ -79,7 +79,7 @@ public class StructureUtil { } static List<IProgramElement> getDeclareInterTypeTargets(IProgramElement node, IProgramElement.Kind kind) { - List<IProgramElement> targets = new ArrayList<IProgramElement>(); + List<IProgramElement> targets = new ArrayList<>(); List<String> 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<String> getMissingStringsInFile(File htmlFile, String[] requiredStrings) throws Exception { - List<String> missingStrings = new ArrayList<String>(); + List<String> missingStrings = new ArrayList<>(); for (String string : requiredStrings) { if (!containsString(htmlFile, string)) { missingStrings.add(string); @@ -120,7 +120,7 @@ public class AjdocOutputChecker { */ public static List<String> getMissingStringsInSection(File htmlFile, String[] requiredStrings, String sectionHeader) throws Exception { - List<String> missingStrings = new ArrayList<String>(); + List<String> 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<IHierarchyListener> structureListeners = new ArrayList<IHierarchyListener>(); + private final List<IHierarchyListener> 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<File> for which the model has been modified during the // last incremental build - private final Set<File> lastBuildChanges = new HashSet<File>(); + private final Set<File> lastBuildChanges = new HashSet<>(); // Record the Set<File> of aspects that wove the files listed in lastBuildChanges - final Set<File> aspectsWeavingInLastBuild = new HashSet<File>(); + final Set<File> aspectsWeavingInLastBuild = new HashSet<>(); // static { // setReporting("c:/model.nfo",true,true,true,true); @@ -149,16 +149,16 @@ public class AsmManager implements IStructureModel { return null; } - HashMap<Integer, List<IProgramElement>> annotations = new HashMap<Integer, List<IProgramElement>>(); + HashMap<Integer, List<IProgramElement>> annotations = new HashMap<>(); IProgramElement node = hierarchy.findElementForSourceFile(sourceFile); if (node == IHierarchy.NO_STRUCTURE) { return null; } else { IProgramElement fileNode = node; - ArrayList<IProgramElement> peNodes = new ArrayList<IProgramElement>(); + ArrayList<IProgramElement> peNodes = new ArrayList<>(); getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType); for (IProgramElement peNode : peNodes) { - List<IProgramElement> entries = new ArrayList<IProgramElement>(); + List<IProgramElement> 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<String, String> pathMap = new HashMap<String, String>(20); + private final Map<String, String> 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<String> deletedNodes = new HashSet<String>(); + Set<String> 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<String> sourcesToRemove = new HashSet<String>(); - Map<String, String> handleToTypenameCache = new HashMap<String, String>(); + Set<String> sourcesToRemove = new HashSet<>(); + Map<String, String> 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<String> sourcehandlesSet = mapper.getEntries(); - List<IRelationship> relationshipsToRemove = new ArrayList<IRelationship>(); + List<IRelationship> 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<String> targets = rel.getTargets(); - List<String> targetsToRemove = new ArrayList<String>(); + List<String> 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<String> sourcesToRemove = new HashSet<String>(); - Set<String> nonExistingHandles = new HashSet<String>(); // Cache of handles that we + Set<String> sourcesToRemove = new HashSet<>(); + Set<String> 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<IRelationship> relationships = mapper.get(hid); - List<IRelationship> relationshipsToRemove = new ArrayList<IRelationship>(); + List<IRelationship> relationshipsToRemove = new ArrayList<>(); // Iterate through the relationships against this source // handle for (IRelationship rel : relationships) { List<String> targets = rel.getTargets(); - List<String> targetsToRemove = new ArrayList<String>(); + List<String> 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<String, Integer> nodeTypeCount = new Hashtable<String, Integer>(); + private final Hashtable<String, Integer> 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<Kind> getNonAJMemberKinds() { - List<Kind> list = new ArrayList<Kind>(); + List<Kind> 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<String, IProgramElement> fileMap = null; - private Map<String, IProgramElement> handleMap = new HashMap<String, IProgramElement>(); + private Map<String, IProgramElement> handleMap = new HashMap<>(); private Map<String, IProgramElement> 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<String, IProgramElement>(); - typeMap = new HashMap<String, IProgramElement>(); + 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<IProgramElement> matchingPackageNodes = new ArrayList<IProgramElement>(); + List<IProgramElement> matchingPackageNodes = new ArrayList<>(); for (IProgramElement sourceFolder : children) { List<IProgramElement> 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<IProgramElement> result = new ArrayList<IProgramElement>(); + List<IProgramElement> result = new ArrayList<>(); result.add(root); return result; } - List<IProgramElement> result = new ArrayList<IProgramElement>(); + List<IProgramElement> 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<String> deletedFiles) { // Only delete the entries we need to from the handle map - for performance reasons - List<String> forRemoval = new ArrayList<String>(); + List<String> forRemoval = new ArrayList<>(); Set<String> 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<IProgramElement.Modifiers> genModifiers(int modifiers) { - List<IProgramElement.Modifiers> modifiersList = new ArrayList<IProgramElement.Modifiers>(); + List<IProgramElement.Modifiers> 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<IProgramElement>(); + 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<IProgramElement>(); + 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<char[]> params = new ArrayList<char[]>(); + List<char[]> 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<String, Object>(); + 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<String, List<IRelationship>> implem if (!createIfMissing) { return null; } - relationships = new ArrayList<IRelationship>(); - IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<String>(), 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<String, List<IRelationship>> 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<String>(), 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<String, List<IRelationship>> implem List<IRelationship> existingRelationships = super.get(source); if (existingRelationships == null) { // new entry - existingRelationships = new ArrayList<IRelationship>(); + 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<String, Integer> utf8Cache = new HashMap<String, Integer>(); - private Map<String, Integer> methodCache = new HashMap<String, Integer>(); - private Map<String, Integer> fieldCache = new HashMap<String, Integer>(); + private Map<String, Integer> utf8Cache = new HashMap<>(); + private Map<String, Integer> methodCache = new HashMap<>(); + private Map<String, Integer> 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<AnnotationGen> accumulatedAnnotations = new ArrayList<AnnotationGen>(); + List<AnnotationGen> 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<AnnotationGen> accumulatedAnnotations = new ArrayList<AnnotationGen>(); + List<AnnotationGen> 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<JavaClass> vec = new ArrayList<JavaClass>(); + List<JavaClass> 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<JavaClass> getAllInterfaces() { - Queue<JavaClass> queue = new LinkedList<JavaClass>(); - List<JavaClass> interfaceList = new ArrayList<JavaClass>(); + Queue<JavaClass> queue = new LinkedList<>(); + List<JavaClass> 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<AnnotationGen[]> annotationsForEachParameter = new ArrayList<AnnotationGen[]>(); + List<AnnotationGen[]> 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<RuntimeAnnos> newAttributes = new ArrayList<RuntimeAnnos>(); + List<RuntimeAnnos> 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<RuntimeParamAnnos> newAttributes = new ArrayList<RuntimeParamAnnos>(); + List<RuntimeParamAnnos> 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<NameValuePair> copyValues(List<NameValuePair> in, ConstantPool cpool, boolean copyPoolEntries) { - List<NameValuePair> out = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair>(); + 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<AnnotationGen>(); + 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<AnnotationGen>(); + 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<AnnotationGen> inflatedAnnotations = new ArrayList<AnnotationGen>(); + List<AnnotationGen> 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<AnnotationGen[]>(); + 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<AnnotationGen[]>(); + 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<AnnotationGen[]> inflatedParameterAnnotations = new ArrayList<AnnotationGen[]>(); + List<AnnotationGen[]> inflatedParameterAnnotations = new ArrayList<>(); for (int i=0; i<numParameters; i++) { int numAnnotations = dis.readUnsignedShort(); if (numAnnotations == 0 ) { diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java index 8b7f0dd3f..943b77f6e 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java @@ -97,11 +97,11 @@ public class ClassGen extends Modifiers implements Cloneable { private int major = Constants.MAJOR_1_1; private int minor = Constants.MINOR_1_1; private ConstantPool cpool; - private List<Field> fieldsList = new ArrayList<Field>(); - private List<Method> methodsList = new ArrayList<Method>(); - private List<Attribute> attributesList = new ArrayList<Attribute>(); - private List<String> interfaceList = new ArrayList<String>(); - private List<AnnotationGen> annotationsList = new ArrayList<AnnotationGen>(); + private List<Field> fieldsList = new ArrayList<>(); + private List<Method> methodsList = new ArrayList<>(); + private List<Attribute> attributesList = new ArrayList<>(); + private List<String> interfaceList = new ArrayList<>(); + private List<AnnotationGen> 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<Attribute>(); + 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<Field> relevantFields = new ArrayList<Field>(); + List<Field> 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<Method> relevantMethods = new ArrayList<Method>(); - List<Method> relevantCtors = new ArrayList<Method>(); + List<Method> relevantMethods = new ArrayList<>(); + List<Method> 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<Attribute> attributeList = new ArrayList<Attribute>(); - protected ArrayList<AnnotationGen> annotationList = new ArrayList<AnnotationGen>(); + private ArrayList<Attribute> attributeList = new ArrayList<>(); + protected ArrayList<AnnotationGen> 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<InstructionTargeter>(); + targeters = new HashSet<>(); } targeters.add(t); } @@ -170,7 +170,7 @@ public class InstructionHandle implements java.io.Serializable { } public Set<InstructionTargeter> getTargetersCopy() { - Set<InstructionTargeter> copy = new HashSet<InstructionTargeter>(); + Set<InstructionTargeter> 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<InstructionHandle> target_vec = new ArrayList<InstructionHandle>(); + ArrayList<InstructionHandle> 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<Instruction> instructions = new ArrayList<Instruction>(); + ArrayList<Instruction> 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<InstructionHandle, InstructionHandle> map = new HashMap<InstructionHandle, InstructionHandle>(); + HashMap<InstructionHandle, InstructionHandle> 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<LocalVariableGen> localVariablesList = new ArrayList<LocalVariableGen>(); - private ArrayList<LineNumberGen> lineNumbersList = new ArrayList<LineNumberGen>(); - private ArrayList<CodeExceptionGen> exceptionsList = new ArrayList<CodeExceptionGen>(); - private ArrayList<String> exceptionsThrown = new ArrayList<String>(); - private ArrayList<Attribute> codeAttributesList = new ArrayList<Attribute>(); + private ArrayList<LocalVariableGen> localVariablesList = new ArrayList<>(); + private ArrayList<LineNumberGen> lineNumbersList = new ArrayList<>(); + private ArrayList<CodeExceptionGen> exceptionsList = new ArrayList<>(); + private ArrayList<String> exceptionsThrown = new ArrayList<>(); + private ArrayList<Attribute> codeAttributesList = new ArrayList<>(); private List<AnnotationGen>[] 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<BranchTarget> branchTargets = new Stack<BranchTarget>(); - Hashtable<InstructionHandle, BranchTarget> visitedTargets = new Hashtable<InstructionHandle, BranchTarget>(); + Stack<BranchTarget> branchTargets = new Stack<>(); + Hashtable<InstructionHandle, BranchTarget> 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<AnnotationGen>(); + param_annotations[j] = new ArrayList<>(); } } @@ -1139,7 +1139,7 @@ public class MethodGen extends FieldGenOrMethodGen { } private List /* AnnotationGen */<AnnotationGen> makeMutableVersion(AnnotationGen[] mutableArray) { - List<AnnotationGen> result = new ArrayList<AnnotationGen>(); + List<AnnotationGen> 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<AnnotationGen> l = new ArrayList<AnnotationGen>(); + List<AnnotationGen> 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<String, Type> commonTypes = new HashMap<String, Type>(); + private static Map<String, Type> 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<Type> argumentTypes = new ArrayList<Type>(); + List<Type> 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<URL, SoftReference<JavaClass>> localCache = new WeakHashMap<URL, SoftReference<JavaClass>>(); - private static SoftHashMap /* <URL,JavaClass> */sharedCache = new SoftHashMap(Collections.synchronizedMap(new HashMap<Object, SpecialValue>())); + private WeakHashMap<URL, SoftReference<JavaClass>> localCache = new WeakHashMap<>(); + private static SoftHashMap /* <URL,JavaClass> */sharedCache = new SoftHashMap(Collections.synchronizedMap(new HashMap<>())); // For fast translation of the classname *intentionally not static* private SoftHashMap /* <String,URL> */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<JavaClass>(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<PathEntry> vec = new ArrayList<PathEntry>(); + ArrayList<PathEntry> 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<String> list = new ArrayList<String>(); + ArrayList<String> list = new ArrayList<>(); getPathComponents(class_path, list); getPathComponents(boot_path, list); - ArrayList<String> dirs = new ArrayList<String>(); + ArrayList<String> 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<Object,SpecialValue>()); + this(new HashMap<>()); } public SoftHashMap(Map<Object,SpecialValue> 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<ClassPath, SyntheticRepository> _instances = new HashMap<ClassPath, SyntheticRepository>(); // CLASSPATH + private static HashMap<ClassPath, SyntheticRepository> _instances = new HashMap<>(); // CLASSPATH // X // REPOSITORY private ClassPath _path = null; - private WeakHashMap<String, JavaClass> _loadedClasses = new WeakHashMap<String, JavaClass>(); // CLASSNAME X JAVACLASS + private WeakHashMap<String, JavaClass> _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<NameValuePair> elements = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair> elements = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<AnnotationGen> v = new Vector<AnnotationGen>(); + Vector<AnnotationGen> v = new Vector<>(); v.add(a); Collection<RuntimeAnnos> 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<AnnotationGen> v2 = new Vector<AnnotationGen>(); + Vector<AnnotationGen> v2 = new Vector<>(); v2.add(a2); Collection<RuntimeAnnos> 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<Attribute> chosenAttrsList = new ArrayList<Attribute>(); + List<Attribute> 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<Attribute> chosenAttrsList = new ArrayList<Attribute>(); + List<Attribute> 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<NameValuePair> elements = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair> elements = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair> elements = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair> elements = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair> elements = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<String> vec = new ArrayList<String>(); + ArrayList<String> 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<DoneChecker> loaders = new ArrayList<DoneChecker>(); + List<DoneChecker> 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<NameValuePair> elements = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair> elements = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair> elements = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<String> getListOfAnnotationNames(AnnotationGen a) { List<NameValuePair> l = a.getValues(); - List<String> names = new ArrayList<String>(); + List<String> 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<AbortException> porters = new ArrayList<AbortException>(); + private static final ArrayList<AbortException> porters = new ArrayList<>(); /** * Get a porter exception from the pool. Porter exceptions do <b>not</b> 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<IMessage.Kind, IntHolder>(); + 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<IMessage>(); - ignoring = new ArrayList<IMessage.Kind>(); + 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<IMessage> result = new ArrayList<IMessage>(); + ArrayList<IMessage> 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<IMessage> result = new ArrayList<IMessage>(); + ArrayList<IMessage> 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<IMessage> result = (accumulate ? new ArrayList<IMessage>() : null); + ArrayList<IMessage> 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<Stack<ContextStackEntry>> contextMap = new ThreadLocal<Stack<ContextStackEntry>>(); + private static ThreadLocal<Stack<ContextStackEntry>> contextMap = new ThreadLocal<>(); // single thread mode stack - private static Stack<ContextStackEntry> contextStack = new Stack<ContextStackEntry>(); + private static Stack<ContextStackEntry> contextStack = new Stack<>(); // formatters, by phase id - private static Map<Integer, ContextFormatter> formatterMap = new HashMap<Integer, ContextFormatter>(); + private static Map<Integer, ContextFormatter> formatterMap = new HashMap<>(); private static ContextFormatter defaultFormatter = new DefaultFormatter(); @@ -131,7 +131,7 @@ public class CompilationAndWeavingContext { */ public static String getCurrentContext() { Stack<ContextStackEntry> contextStack = getContextStack(); - Stack<String> explanationStack = new Stack<String>(); + Stack<String> 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<ContextStackEntry> contextStack = getContextStack(); ContextTokenImpl nextToken = nextToken(); - contextStack.push(new ContextStackEntry(nextToken, phaseId, new WeakReference<Object>(data))); + contextStack.push(new ContextStackEntry(nextToken, phaseId, new WeakReference<>(data))); return nextToken; } @@ -183,7 +183,7 @@ public class CompilationAndWeavingContext { } else { Stack<ContextStackEntry> contextStack = contextMap.get(); if (contextStack == null) { - contextStack = new Stack<ContextStackEntry>(); + 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<String,Target> targets = new Hashtable<String, Target>(); + Hashtable<String,Target> 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<String> toReturn = new ArrayList<String>(); + ArrayList<String> 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<String,License>(); + 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<String> newYears = new ArrayList<String>(); + List<String> 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<String> years = new ArrayList<String>(); + ArrayList<String> 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<If> ifs; protected List<If> ifs() { - return ifs != null ? ifs : (ifs = new Vector<If>()); + return ifs != null ? ifs : (ifs = new Vector<>()); } public If createIf() { @@ -169,7 +169,7 @@ public abstract class ConditionalTask extends Task { protected List<String> getFalses() { Iterator<If> iter = ifs().iterator(); - List<String> result = new Vector<String>(); + List<String> 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<String> strings = new ArrayList<String>(); + List<String> 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<String> errors = new ArrayList<String>(); + ArrayList<String> errors = new ArrayList<>(); try { return buildAll(result, errors); } finally { @@ -340,7 +340,7 @@ public abstract class Builder { */ protected final boolean buildAll(Result result, List<String> errors) { Result[] buildList = skipUptodate(getAntecedantResults(result)); - ArrayList<String> doneList = new ArrayList<String>(); + ArrayList<String> 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<File> found = new ArrayList<File>(); + final ArrayList<File> 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<ProductModule> results = new ArrayList<ProductModule>(); + ArrayList<ProductModule> 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<File> sourceFiles(File srcDir) { - ArrayList<File> result = new ArrayList<File>(); + ArrayList<File> 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<File>(); - this.exportedLibJars = new ArrayList<File>(); - this.requiredModules = new ArrayList<Module>(); - this.srcDirs = new ArrayList<File>(); - this.classpathVariables = new ArrayList<String>(); + 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<String> result = new ArrayList<String>(); + ArrayList<String> 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<String,Module> modules = new Hashtable<String,Module>(); + private final Hashtable<String,Module> 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<String,Result> nameToResult = new HashMap<String, Result>(); + private static final HashMap<String,Result> 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<File>(); - this.exportedLibJars = new ArrayList<File>(); - this.srcDirs = new ArrayList<File>(); - this.classpathVariables = new ArrayList<String>(); - this.requiredResults = new ArrayList<Result>(); + 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<File> findJarRequirements() { - ArrayList<File> result = new ArrayList<File>(); + ArrayList<File> 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<Sample> samples = new ArrayList<Sample>(); + private ArrayList<Sample> samples = new ArrayList<>(); int size() { return samples.size(); } @@ -419,7 +419,7 @@ class Samples { } List<Sample> getSortedSamples(Comparator<Sample> comparer) { - ArrayList<Sample> result = new ArrayList<Sample>(); + ArrayList<Sample> 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<String> result = new ArrayList<String>(); + ArrayList<String> 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<File> result = new ArrayList<File>(); + ArrayList<File> 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<File> unknownFiles = new ArrayList<File>(); + ArrayList<File> 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<String> STATIC_ERRORS = new ArrayList<String>(); + private static final ArrayList<String> STATIC_ERRORS = new ArrayList<>(); // Builder.BINARY_SOURCE_PATTERN and Builder.RESOURCE_PATTERN public static final List<String> KNOWN_SUFFIXES; static { - List<String> suffixes = new ArrayList<String>(); + List<String> 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<File> tempFiles = new ArrayList<File>(); + ArrayList<File> 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<String> entryNames = new ArrayList<String>(); + ArrayList<String> 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<File> tempFiles = new ArrayList<File>(); + ArrayList<File> tempFiles = new ArrayList<>(); public ModulesTest(String name) { super(name); @@ -101,7 +101,7 @@ public class ModulesTest extends TestCase { } public void testAllModulesCreation() { - ArrayList<Module> badModules = new ArrayList<Module>(); + ArrayList<Module> 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<String>(); + 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<AdaptorKey,ExplicitlyInitializedClassLoaderWeavingAdaptor> weavingAdaptors = - Collections.synchronizedMap(new HashMap<AdaptorKey,ExplicitlyInitializedClassLoaderWeavingAdaptor>()); + 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<TypePattern> dumpTypePattern = new ArrayList<TypePattern>(); + private List<TypePattern> dumpTypePattern = new ArrayList<>(); private boolean dumpBefore = false; private boolean dumpDirPerClassloader = false; private boolean hasExcludes = false; - private List<TypePattern> excludeTypePattern = new ArrayList<TypePattern>(); // anything - private List<String> excludeStartsWith = new ArrayList<String>(); // com.foo..* - private List<String> excludeStarDotDotStar = new ArrayList<String>(); // *..*CGLIB* - private List<String> excludeExactName = new ArrayList<String>(); // com.foo.Bar - private List<String> excludeEndsWith = new ArrayList<String>(); // com.foo.Bar - private List<String[]> excludeSpecial = new ArrayList<String[]>(); + private List<TypePattern> excludeTypePattern = new ArrayList<>(); // anything + private List<String> excludeStartsWith = new ArrayList<>(); // com.foo..* + private List<String> excludeStarDotDotStar = new ArrayList<>(); // *..*CGLIB* + private List<String> excludeExactName = new ArrayList<>(); // com.foo.Bar + private List<String> excludeEndsWith = new ArrayList<>(); // com.foo.Bar + private List<String[]> excludeSpecial = new ArrayList<>(); private boolean hasIncludes = false; - private List<TypePattern> includeTypePattern = new ArrayList<TypePattern>(); - private List<String> includeStartsWith = new ArrayList<String>(); - private List<String> includeExactName = new ArrayList<String>(); + private List<TypePattern> includeTypePattern = new ArrayList<>(); + private List<String> includeStartsWith = new ArrayList<>(); + private List<String> includeExactName = new ArrayList<>(); private boolean includeStar = false; - private List<TypePattern> aspectExcludeTypePattern = new ArrayList<TypePattern>(); - private List<String> aspectExcludeStartsWith = new ArrayList<String>(); - private List<TypePattern> aspectIncludeTypePattern = new ArrayList<TypePattern>(); - private List<String> aspectIncludeStartsWith = new ArrayList<String>(); + private List<TypePattern> aspectExcludeTypePattern = new ArrayList<>(); + private List<String> aspectExcludeStartsWith = new ArrayList<>(); + private List<TypePattern> aspectIncludeTypePattern = new ArrayList<>(); + private List<String> aspectIncludeStartsWith = new ArrayList<>(); private StringBuffer namespace; private IWeavingContext weavingContext; - private List<ConcreteAspectCodeGen> concreteAspects = new ArrayList<ConcreteAspectCodeGen>(); + private List<ConcreteAspectCodeGen> concreteAspects = new ArrayList<>(); private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassLoaderWeavingAdaptor.class); @@ -218,7 +218,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { * @return */ List<String> getAspectClassNames(List<Definition> definitions) { - List<String> aspects = new LinkedList<String>(); + List<String> aspects = new LinkedList<>(); for (Definition def : definitions) { List<String> defAspects = def.getAspectClassNames(); if (defAspects != null) { @@ -238,7 +238,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { trace.enter("parseDefinitions", this); } - List<Definition> definitions = new ArrayList<Definition>(); + List<Definition> 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<URL> xmls = weavingContext.getResources(nextDefinition); // System.out.println("? registerDefinitions: found-aop.xml=" + xmls.hasMoreElements() + ", loader=" + loader); - Set<URL> seenBefore = new HashSet<URL>(); + Set<URL> 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<String, IUnwovenClassFile>(); + 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<String> elligibleAbstractions = new ArrayList<String>(); + List<String> elligibleAbstractions = new ArrayList<>(); Collection<ResolvedMember> abstractMethods = getOutstandingAbstractMethods(parent); for (ResolvedMember method : abstractMethods) { @@ -254,7 +254,7 @@ public class ConcreteAspectCodeGen { } } } - List<String> pointcutNames = new ArrayList<String>(); + List<String> pointcutNames = new ArrayList<>(); for (Definition.Pointcut abstractPc : concreteAspect.pointcuts) { pointcutNames.add(abstractPc.name); } @@ -283,7 +283,7 @@ public class ConcreteAspectCodeGen { } private Collection<ResolvedMember> getOutstandingAbstractMethods(ResolvedType type) { - Map<String, ResolvedMember> collector = new HashMap<String, ResolvedMember>(); + Map<String, ResolvedMember> 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<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<String> values = new ArrayList<String>(); + List<String> 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<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<Type> paramTypes = new ArrayList<Type>(); - List<String> paramNames = new ArrayList<String>(); + List<Type> paramTypes = new ArrayList<>(); + List<String> 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<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> 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<Definition> testList = new ArrayList<Definition>(); + List<Definition> 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<File> xmlfileList = new ArrayList<File>(); + List<File> xmlfileList = new ArrayList<>(); xmlfileList.addAll(parser.getXmlFiles()); - List<File> fileList = new ArrayList<File>(); + List<File> fileList = new ArrayList<>(); List<File> files = parser.getFiles(); if (!LangUtil.isEmpty(files)) { if (incrementalMode) { @@ -165,7 +165,7 @@ public class BuildArgParser extends Main { } } - List<String> javaArgList = new ArrayList<String>(); + List<String> 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<String> toArrayList(java.util.List<File> files) { - ArrayList<String> arrayList = new ArrayList<String>(); + ArrayList<String> arrayList = new ArrayList<>(); for (File file: files) { arrayList.add(file.getAbsolutePath()); } @@ -363,7 +363,7 @@ public class BuildArgParser extends Main { } public List<String> getBootclasspath(AjcConfigParser parser) { - List<String> ret = new ArrayList<String>(); + List<String> ret = new ArrayList<>(); if (parser.bootclasspath == null) { if (LangUtil.is19VMOrGreater()) { @@ -378,13 +378,13 @@ public class BuildArgParser extends Main { } public List<String> getModulepath(AjcConfigParser parser) { - List<String> ret = new ArrayList<String>(); + List<String> ret = new ArrayList<>(); addClasspath(parser.modulepath, ret); return ret; } public List<String> getModulesourcepath(AjcConfigParser parser) { - List<String> ret = new ArrayList<String>(); + List<String> 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<File> sourceRoots = new ArrayList<File>(); + List<File> 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<File> files = new LinkedList<File>(); - protected List<File> xmlfiles = new ArrayList<File>(); + protected List<File> files = new LinkedList<>(); + protected List<File> 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<Arg> args = new LinkedList<Arg>(); + LinkedList<Arg> args = new LinkedList<>(); for (String s : argsArray) { args.add(new Arg(s, location)); } @@ -80,7 +80,7 @@ public class ConfigParser { return; } - LinkedList<Arg> args = new LinkedList<Arg>(); + LinkedList<Arg> 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<String, List<UnwovenClassFile>> binarySourceSetForFullWeave = new HashMap<String, List<UnwovenClassFile>>(); + private Map<String, List<UnwovenClassFile>> 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<InterimCompilationResult> resultsPendingWeave = new ArrayList<InterimCompilationResult>(); + List<InterimCompilationResult> 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<CompilationUnitDeclaration> aspects = new ArrayList<CompilationUnitDeclaration>(); - List<CompilationUnitDeclaration> nonaspects = new ArrayList<CompilationUnitDeclaration>(); + List<CompilationUnitDeclaration> aspects = new ArrayList<>(); + List<CompilationUnitDeclaration> 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<InterimCompilationResult>(); + resultsPendingWeave = new ArrayList<>(); reportedErrors = false; droppingBackToFullBuild = false; } @@ -475,7 +475,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { private List<InterimCompilationResult> getBinarySourcesFrom(Map<String, List<UnwovenClassFile>> binarySourceEntries) { // Map is fileName |-> List<UnwovenClassFile> - List<InterimCompilationResult> ret = new ArrayList<InterimCompilationResult>(); + List<InterimCompilationResult> ret = new ArrayList<>(); for (String sourceFileName : binarySourceEntries.keySet()) { List<UnwovenClassFile> 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<IProblem> ret = new ArrayList<IProblem>(); + List<IProblem> 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<TypeBinding, Map<FieldBinding, ResolvedMember>> alreadyProcessedReceivers = new HashMap<TypeBinding, Map<FieldBinding, ResolvedMember>>(); + private Map<TypeBinding, Map<FieldBinding, ResolvedMember>> 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<FieldBinding, ResolvedMember> alreadyResolvedMembers = alreadyProcessedReceivers.get(receiverType); if (alreadyResolvedMembers == null) { - alreadyResolvedMembers = new HashMap<FieldBinding, ResolvedMember>(); + 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<Proceed> proceedCalls = new ArrayList<Proceed>(2); // populated during Proceed.findEnclosingAround + public List<Proceed> 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<EclipseAttributeAdapter> l = new ArrayList<EclipseAttributeAdapter>(1); + List<EclipseAttributeAdapter> 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<ResolvedMember, Binding> accessForInline = new LinkedHashMap<ResolvedMember, Binding>(); - public Map<ResolvedMember, AccessForInlineVisitor.SuperAccessMethodPair> superAccessForInline = new HashMap<ResolvedMember, AccessForInlineVisitor.SuperAccessMethodPair>(); + public Map<ResolvedMember, Binding> accessForInline = new LinkedHashMap<>(); + public Map<ResolvedMember, AccessForInlineVisitor.SuperAccessMethodPair> superAccessForInline = new HashMap<>(); public boolean isPrivileged; public EclipseSourceType concreteName; public ReferenceType typeX; @@ -418,7 +418,7 @@ public class AspectDeclaration extends TypeDeclaration { } protected List<EclipseAttributeAdapter> makeEffectiveSignatureAttribute(ResolvedMember sig, Shadow.Kind kind, boolean weaveBody) { - List<EclipseAttributeAdapter> l = new ArrayList<EclipseAttributeAdapter>(1); + List<EclipseAttributeAdapter> 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<SourceTypeBinding> pendingTypesToWeave = new ArrayList<SourceTypeBinding>(); + private final List<SourceTypeBinding> 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<SourceTypeBinding> typesToProcess = new ArrayList<SourceTypeBinding>(); - List<SourceTypeBinding> aspectsToProcess = new ArrayList<SourceTypeBinding>(); + List<SourceTypeBinding> typesToProcess = new ArrayList<>(); + List<SourceTypeBinding> 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<SourceTypeBinding>(); + 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<SourceTypeBinding> stb2 = new ArrayList<SourceTypeBinding>(); + List<SourceTypeBinding> 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<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>(); - List<DeclareAnnotation> decaToRepeat = new ArrayList<DeclareAnnotation>(); + List<DeclareParents> decpToRepeat = new ArrayList<>(); + List<DeclareAnnotation> decaToRepeat = new ArrayList<>(); boolean anyNewParents = false; boolean anyNewAnnotations = false; @@ -768,7 +768,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC } } - List<Object> forRemoval = new ArrayList<Object>(); + List<Object> 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<String> s = new HashSet<String>(); + Set<String> 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<UnresolvedType, TypeBinding> typexToBinding = new HashMap<UnresolvedType, TypeBinding>(); - private final Map<UnresolvedType, TypeBinding> rawTypeXToBinding = new HashMap<UnresolvedType, TypeBinding>(); + private final Map<UnresolvedType, TypeBinding> typexToBinding = new HashMap<>(); + private final Map<UnresolvedType, TypeBinding> 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<TypeVariableBinding,UnresolvedType> typeVariableBindingsInProgress = new HashMap<TypeVariableBinding,UnresolvedType>(); + private static Map<TypeVariableBinding,UnresolvedType> 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<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> ret = new ArrayList<>(); List<ConcreteTypeMunger> 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<String,UnresolvedType> typeVariablesForThisMember = new HashMap<String, UnresolvedType>(); + private final Map<String,UnresolvedType> 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<String,TypeVariableBinding> typeVariableToTypeBinding = new HashMap<String,TypeVariableBinding>(); + private final Map<String,TypeVariableBinding> 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<String> importedNamesList = new ArrayList<String>(); - List<String> importedPrefixesList = new ArrayList<String>(); + List<String> importedNamesList = new ArrayList<>(); + List<String> 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<Declare> declares = new ArrayList<Declare>(); - public List<EclipseTypeMunger> typeMungers = new ArrayList<EclipseTypeMunger>(); + public List<Declare> declares = new ArrayList<>(); + public List<EclipseTypeMunger> typeMungers = new ArrayList<>(); private final EclipseFactory factory; @@ -258,9 +258,9 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate { } protected void fillDeclaredMembers() { - List<ResolvedMember> declaredPointcuts = new ArrayList<ResolvedMember>(); - List<ResolvedMember> declaredMethods = new ArrayList<ResolvedMember>(); - List<ResolvedMember> declaredFields = new ArrayList<ResolvedMember>(); + List<ResolvedMember> declaredPointcuts = new ArrayList<>(); + List<ResolvedMember> declaredMethods = new ArrayList<>(); + List<ResolvedMember> 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<AnnotationTargetKind> targetKinds = new ArrayList<AnnotationTargetKind>(); + List<AnnotationTargetKind> 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<MethodBinding> methods = new ArrayList<MethodBinding>(); + List<MethodBinding> 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<FieldBinding> interTypeFields = new ArrayList<FieldBinding>(); - private List<MethodBinding> interTypeMethods = new ArrayList<MethodBinding>(); + private List<FieldBinding> interTypeFields = new ArrayList<>(); + private List<MethodBinding> 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<MethodBinding> ret = new ArrayList<MethodBinding>(Arrays.asList(orig)); + List<MethodBinding> 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<MethodBinding> ret = new HashSet<MethodBinding>(Arrays.asList(orig)); + Set<MethodBinding> 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<TypeVariableBinding, String>(); + 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<ReferenceBinding> intertypeMemberTypes = new HashSet<ReferenceBinding>(); + private Set<ReferenceBinding> 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<AbstractMethodDeclaration, RepresentationAndLocation> codeRepresentation = new HashMap<AbstractMethodDeclaration, RepresentationAndLocation>(); + private Map<AbstractMethodDeclaration, RepresentationAndLocation> codeRepresentation = new HashMap<>(); // This stores the new annotations - private Map<SourceTypeBinding, List<String>> additionalAnnotations = new HashMap<SourceTypeBinding, List<String>>(); + private Map<SourceTypeBinding, List<String>> additionalAnnotations = new HashMap<>(); // This stores the new parents - private Map<SourceTypeBinding, List<ExactTypePattern>> additionalParents = new HashMap<SourceTypeBinding, List<ExactTypePattern>>(); + private Map<SourceTypeBinding, List<ExactTypePattern>> additionalParents = new HashMap<>(); // This indicates which types are affected by which intertype declarations - private Map<SourceTypeBinding, List<AbstractMethodDeclaration>> newDeclarations = new HashMap<SourceTypeBinding, List<AbstractMethodDeclaration>>(); + private Map<SourceTypeBinding, List<AbstractMethodDeclaration>> newDeclarations = new HashMap<>(); private PushinCollector(World world, Properties configuration) { this.world = world; @@ -255,7 +255,7 @@ public class PushinCollector { } List<AbstractMethodDeclaration> amds = newDeclarations.get(sourceType); if (amds == null) { - amds = new ArrayList<AbstractMethodDeclaration>(); + 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<String> annos = additionalAnnotations.get(sourceType); if (annos == null) { - annos = new ArrayList<String>(); + annos = new ArrayList<>(); additionalAnnotations.put(sourceType, annos); } annos.add(annotationString); @@ -322,7 +322,7 @@ public class PushinCollector { if (typePattern instanceof ExactTypePattern) { List<ExactTypePattern> annos = additionalParents.get(sourceType); if (annos == null) { - annos = new ArrayList<ExactTypePattern>(); + 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<File> sourceRoots = new ArrayList<File>(); + private List<File> sourceRoots = new ArrayList<>(); private List<File> changedFiles; - private List<File> files = new ArrayList<File>(); - private List<File> xmlfiles = new ArrayList<File>(); + private List<File> files = new ArrayList<>(); + private List<File> xmlfiles = new ArrayList<>(); private String processor; private String processorPath; - private List<BinarySourceFile> binaryFiles = new ArrayList<BinarySourceFile>(); // .class files in indirs... - private List<File> inJars = new ArrayList<File>(); - private List<File> inPath = new ArrayList<File>(); - private Map<String, File> sourcePathResources = new HashMap<String, File>(); - private List<File> aspectpath = new ArrayList<File>(); - private List<String> classpath = new ArrayList<String>(); - private List<String> modulepath = new ArrayList<String>(); + private List<BinarySourceFile> binaryFiles = new ArrayList<>(); // .class files in indirs... + private List<File> inJars = new ArrayList<>(); + private List<File> inPath = new ArrayList<>(); + private Map<String, File> sourcePathResources = new HashMap<>(); + private List<File> aspectpath = new ArrayList<>(); + private List<String> classpath = new ArrayList<>(); + private List<String> modulepath = new ArrayList<>(); // Expensive to compute (searching modules, parsing module-info) private ArrayList<Classpath> modulepathClasspathEntries = null; - private List<String> modulesourcepath = new ArrayList<String>(); + private List<String> modulesourcepath = new ArrayList<>(); // Expensive to compute (searching modules, parsing module-info) private ArrayList<Classpath> modulesourcepathClasspathEntries = null; private Classpath[] checkedClasspaths = null; - private List<String> bootclasspath = new ArrayList<String>(); - private List<String> cpElementsWithModifiedContents = new ArrayList<String>(); + private List<String> bootclasspath = new ArrayList<>(); + private List<String> cpElementsWithModifiedContents = new ArrayList<>(); private IModule moduleDesc; private File configFile; @@ -251,7 +251,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { } private List<Classpath> processFilePath(List<File> path, java.lang.String encoding) { - List<Classpath> entries = new ArrayList<Classpath>(); + List<Classpath> 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<Classpath> processStringPath(List<String> path, java.lang.String encoding) { - List<Classpath> entries = new ArrayList<Classpath>(); + List<Classpath> 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<BinarySourceFile>(); + 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<String> getFullClasspath() { - List<String> full = new ArrayList<String>(); + List<String> 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<String,String>(); + 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<String, String> lintOptions = new HashMap<String, String>(); + Map<String, String> 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<Classpath> allPaths = handleBootclasspath(bootclasspaths, customEncoding); - ArrayList<FileSystem.Classpath> allPaths = new ArrayList<FileSystem.Classpath>(); + ArrayList<FileSystem.Classpath> 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<UnwovenClassFile>> /* String -> List<UCF> */binarySourcesForTheNextCompile = new HashMap<String, List<UnwovenClassFile>>(); + private Map<String, List<UnwovenClassFile>> /* String -> List<UCF> */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<File, List<String>> findOutputDirsForAspects() { - Map<File, List<String>> outputDirsToAspects = new HashMap<File, List<String>>(); + Map<File, List<String>> outputDirsToAspects = new HashMap<>(); Map<String, char[]> 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<String> aspectNames = new ArrayList<String>(); + List<String> aspectNames = new ArrayList<>(); if (aspectNamesToFileNames != null) { Set<String> 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<String>()); + outputDirsToAspects.put(outputDir, new ArrayList<>()); } if (aspectNamesToFileNames != null) { Set<Map.Entry<String, char[]>> 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<String>()); + 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<String, IProgramElement>()); + 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<UnwovenClassFile> ucfl = new ArrayList<UnwovenClassFile>(); + List<UnwovenClassFile> 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<File> affectedFiles = new HashSet<File>(); + private final Set<File> 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<BinarySourceFile> addedBinaryFiles; private Set<BinarySourceFile> deletedBinaryFiles; // For a particular build run, this set records the changes to classesFromName - public final Set<String> deltaAddedClasses = new HashSet<String>(); + public final Set<String> 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<String, Long> structuralChangesSinceLastFullBuild = new Hashtable<String, Long>(); + private final Hashtable<String, Long> 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<File, List<ClassFile>> fullyQualifiedTypeNamesResultingFromCompilationUnit = new HashMap<File, List<ClassFile>>(); + private final Map<File, List<ClassFile>> fullyQualifiedTypeNamesResultingFromCompilationUnit = new HashMap<>(); /** * Source files defining aspects Populated in noteResult and used in processDeletedFiles */ - private final Set<File> sourceFilesDefiningAspects = new HashSet<File>(); + private final Set<File> 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<File, ReferenceCollection> references = new HashMap<File, ReferenceCollection>(); + private final Map<File, ReferenceCollection> 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<String, List<UnwovenClassFile>> binarySourceFiles = new HashMap<String, List<UnwovenClassFile>>(); + private Map<String, List<UnwovenClassFile>> 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<String, List<ClassFile>> inputClassFilesBySource = new HashMap<String, List<ClassFile>>(); + private final Map<String, List<ClassFile>> inputClassFilesBySource = new HashMap<>(); /** * A list of the .class files created by this state that contain aspects. */ - private final List<String> aspectClassFiles = new ArrayList<String>(); + private final List<String> 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<String, CompactTypeStructureRepresentation> resolvedTypeStructuresFromLastBuild = new HashMap<String, CompactTypeStructureRepresentation>(); + private final Map<String, CompactTypeStructureRepresentation> 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<String, File> classesFromName = new HashMap<String, File>(); + private final Map<String, File> 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<String, char[]> aspectsFromFileNames; - private Set<File> compiledSourceFiles = new HashSet<File>(); - private final Map<String, File> resources = new HashMap<String, File>(); + private Set<File> compiledSourceFiles = new HashSet<>(); + private final Map<String, File> resources = new HashMap<>(); SoftHashMap/* <baseDir,SoftHashMap<theFile,className>> */fileToClassNameMap = new SoftHashMap(); @@ -313,21 +313,21 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe addedFiles = Collections.emptySet(); deletedFiles = Collections.emptySet(); } else { - Set<File> oldFiles = new HashSet<File>(buildConfig.getFiles()); - Set<File> newFiles = new HashSet<File>(newBuildConfig.getFiles()); + Set<File> oldFiles = new HashSet<>(buildConfig.getFiles()); + Set<File> newFiles = new HashSet<>(newBuildConfig.getFiles()); - addedFiles = new HashSet<File>(newFiles); + addedFiles = new HashSet<>(newFiles); addedFiles.removeAll(oldFiles); - deletedFiles = new HashSet<File>(oldFiles); + deletedFiles = new HashSet<>(oldFiles); deletedFiles.removeAll(newFiles); } - Set<BinarySourceFile> oldBinaryFiles = new HashSet<BinarySourceFile>(buildConfig.getBinaryFiles()); - Set<BinarySourceFile> newBinaryFiles = new HashSet<BinarySourceFile>(newBuildConfig.getBinaryFiles()); + Set<BinarySourceFile> oldBinaryFiles = new HashSet<>(buildConfig.getBinaryFiles()); + Set<BinarySourceFile> newBinaryFiles = new HashSet<>(newBuildConfig.getBinaryFiles()); - addedBinaryFiles = new HashSet<BinarySourceFile>(newBinaryFiles); + addedBinaryFiles = new HashSet<>(newBinaryFiles); addedBinaryFiles.removeAll(oldBinaryFiles); - deletedBinaryFiles = new HashSet<BinarySourceFile>(oldBinaryFiles); + deletedBinaryFiles = new HashSet<>(oldBinaryFiles); deletedBinaryFiles.removeAll(newBinaryFiles); boolean couldStillBeIncremental = processDeletedFiles(deletedFiles); @@ -376,7 +376,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe } Collection<File> getModifiedFiles(long lastBuildTime) { - Set<File> ret = new HashSet<File>(); + Set<File> ret = new HashSet<>(); // Check if the build configuration knows what files have changed... List<File> modifiedFiles = buildConfig.getModifiedFiles(); @@ -408,7 +408,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe } Collection<BinarySourceFile> getModifiedBinaryFiles(long lastBuildTime) { - List<BinarySourceFile> ret = new ArrayList<BinarySourceFile>(); + List<BinarySourceFile> 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<File> oldOutputLocs = getOutputLocations(previousConfig); - Set<String> alreadyAnalysedPaths = new HashSet<String>(); + Set<String> alreadyAnalysedPaths = new HashSet<>(); List<String> oldClasspath = previousConfig.getClasspath(); List<String> newClasspath = newConfig.getClasspath(); @@ -926,7 +926,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe * @return a list of file objects */ private List<File> getOutputLocations(AjBuildConfig config) { - List<File> outputLocs = new ArrayList<File>(); + List<File> 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<File> getFilesToCompile(boolean firstPass) { - Set<File> thisTime = new HashSet<File>(); + Set<File> thisTime = new HashSet<>(); if (firstPass) { - compiledSourceFiles = new HashSet<File>(); + compiledSourceFiles = new HashSet<>(); Collection<File> 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<String, List<UnwovenClassFile>> toWeave = new HashMap<String, List<UnwovenClassFile>>(); + Map<String, List<UnwovenClassFile>> toWeave = new HashMap<>(); if (firstTime) { - List<BinarySourceFile> addedOrModified = new ArrayList<BinarySourceFile>(); + List<BinarySourceFile> 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<UnwovenClassFile> ucfs = new ArrayList<UnwovenClassFile>(); + List<UnwovenClassFile> ucfs = new ArrayList<>(); ucfs.add(ucf); recordTypeChanged(ucf.getClassName()); binarySourceFiles.put(bsf.binSrc.getPath(), ucfs); - List<ClassFile> cfs = new ArrayList<ClassFile>(1); + List<ClassFile> 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<ClassFile> classFiles = new ArrayList<ClassFile>(); + List<ClassFile> 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<String, List<UnwovenClassFile>>(); + this.binarySourceFiles = new HashMap<>(); } public void recordBinarySource(String fromPathName, List<UnwovenClassFile> unwovenClassFiles) { this.binarySourceFiles.put(fromPathName, unwovenClassFiles); if (this.maybeIncremental()) { - List<ClassFile> simpleClassFiles = new LinkedList<ClassFile>(); + List<ClassFile> 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<String, char[]>(); + 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.<String>emptyList()); pe.setParameterSignatures(Collections.<char[]>emptyList(), Collections.<String>emptyList()); } else { - List<String> names = new ArrayList<String>(); - List<char[]> paramSigs = new ArrayList<char[]>(); - List<String> paramSourceRefs = new ArrayList<String>(); + List<String> names = new ArrayList<>(); + List<char[]> paramSigs = new ArrayList<>(); + List<String> 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<String> parents = new ArrayList<String>(); + List<String> 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<String, AjState> incrementalStates = new Hashtable<String, AjState>(); + private static Hashtable<String, AjState> 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<String,File> classesFromName, AjState state) { this.classesFromName = classesFromName; - this.inflatedClassFilesCache = new HashMap<String,NameEnvironmentAnswer>(); + this.inflatedClassFilesCache = new HashMap<>(); this.baseEnvironment = baseEnvironment; this.state = state; - packageNames = new HashSet<String>(); + 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<String> args = new ArrayList<String>(); + List<String> 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<String> args = new ArrayList<String>(); + List<String> 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<String>(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<Message> warningMessages = new ArrayList<Message>(); + List<Message> 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<IMessage> messages = new ArrayList<IMessage>(); + List<IMessage> 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<String> cp = new ArrayList<String>(); + List<String> cp = new ArrayList<>(); cp.add("adir"); cp.add("ajar.jar"); oldConfig.setClasspath(cp); - newConfig.setClasspath(new ArrayList<String>(cp)); - List<File> ap = new ArrayList<File>(); + newConfig.setClasspath(new ArrayList<>(cp)); + List<File> ap = new ArrayList<>(); ap.add(new File("aLib.jar")); ap.add(new File("anotherLib.jar")); oldConfig.setAspectpath(ap); - newConfig.setAspectpath(new ArrayList<File>(ap)); - List<File> ip = new ArrayList<File>(); + newConfig.setAspectpath(new ArrayList<>(ap)); + List<File> ip = new ArrayList<>(); ip.add(new File("adir")); ip.add(new File("ajar.jar")); oldConfig.setInPath(ip); - newConfig.setInPath(new ArrayList<File>(ip)); - List<File> ij = new ArrayList<File>(); + newConfig.setInPath(new ArrayList<>(ip)); + List<File> ij = new ArrayList<>(); ij.add(new File("aLib.jar")); ij.add(new File("anotherLib.jar")); oldConfig.setInJars(ij); - newConfig.setInJars(new ArrayList<File>(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<String,String> options = new HashMap<String,String>(); + HashMap<String,String> 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<SourceRange> sourceRanges = new ArrayList<SourceRange>(); + private List<SourceRange> sourceRanges = new ArrayList<>(); public List<SourceRange> 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<SourceRange> getSourceRanges(int[][] sourceRanges) { - List<SourceRange> convertedRanges = new ArrayList<SourceRange>(); + List<SourceRange> 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<IMessage> fails = new ArrayList<IMessage>(); - List<IMessage> errors = new ArrayList<IMessage>(); - List<IMessage> warnings = new ArrayList<IMessage>(); - List<IMessage> infos = new ArrayList<IMessage>(); - List<IMessage> weaves = new ArrayList<IMessage>(); + List<IMessage> fails = new ArrayList<>(); + List<IMessage> errors = new ArrayList<>(); + List<IMessage> warnings = new ArrayList<>(); + List<IMessage> infos = new ArrayList<>(); + List<IMessage> 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<Message> newMessageList(Message m1) { - List<Message> ret = new ArrayList<Message>(); + List<Message> 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<Message> newMessageList(Message m1, Message m2) { - List<Message> ret = new ArrayList<Message>(); + List<Message> 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<Message> newMessageList(Message m1, Message m2, Message m3) { - List<Message> ret = new ArrayList<Message>(); + List<Message> ret = new ArrayList<>(); ret.add(m1); ret.add(m2); ret.add(m3); @@ -785,7 +785,7 @@ public abstract class AjcTestCase extends TestCase { private List<String >tokenizeCommand(String command) { StringTokenizer st = new StringTokenizer(command," ", false); - ArrayList<String> arguments = new ArrayList<String>(); + ArrayList<String> 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<T> out = new ArrayList<T>(); + List<T> 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<String> list = new ArrayList<String>(); + ArrayList<String> 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<GenericSignature.FormalTypeParameter> typeParameters = new ArrayList<GenericSignature.FormalTypeParameter>(); + List<GenericSignature.FormalTypeParameter> 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<ShadowMunger> shadowMungers = new ArrayList<ShadowMunger>(4); - private List<ConcreteTypeMunger> typeMungers = new ArrayList<ConcreteTypeMunger>(4); - private List<ConcreteTypeMunger> lateTypeMungers = new ArrayList<ConcreteTypeMunger>(0); + private List<ShadowMunger> shadowMungers = new ArrayList<>(4); + private List<ConcreteTypeMunger> typeMungers = new ArrayList<>(4); + private List<ConcreteTypeMunger> lateTypeMungers = new ArrayList<>(0); - private Set<DeclareParents> declareParents = new HashSet<DeclareParents>(); - private Set<DeclareSoft> declareSofts = new HashSet<DeclareSoft>(); - private List<Declare> declareDominates = new ArrayList<Declare>(4); + private Set<DeclareParents> declareParents = new HashSet<>(); + private Set<DeclareSoft> declareSofts = new HashSet<>(); + private List<Declare> declareDominates = new ArrayList<>(4); // These are like declare parents type mungers - private Set<DeclareAnnotation> declareAnnotationsOnType = new LinkedHashSet<DeclareAnnotation>(); - private Set<DeclareAnnotation> declareAnnotationsOnField = new LinkedHashSet<DeclareAnnotation>(); - private Set<DeclareAnnotation> declareAnnotationsOnMethods = new LinkedHashSet<DeclareAnnotation>(); + private Set<DeclareAnnotation> declareAnnotationsOnType = new LinkedHashSet<>(); + private Set<DeclareAnnotation> declareAnnotationsOnField = new LinkedHashSet<>(); + private Set<DeclareAnnotation> declareAnnotationsOnMethods = new LinkedHashSet<>(); // declareAnnotationsOnMethods includes constructors too - private Set<DeclareTypeErrorOrWarning> declareTypeEow = new HashSet<DeclareTypeErrorOrWarning>(); + private Set<DeclareTypeErrorOrWarning> declareTypeEow = new HashSet<>(); private boolean shouldConcretizeIfNeeded = true; @@ -74,8 +74,8 @@ public class CrosscuttingMembers { this.shouldConcretizeIfNeeded = shouldConcretizeIfNeeded; } - private final Hashtable<String, Object> cflowFields = new Hashtable<String, Object>(); - private final Hashtable<String, Object> cflowBelowFields = new Hashtable<String, Object>(); + private final Hashtable<String, Object> cflowFields = new Hashtable<>(); + private final Hashtable<String, Object> cflowBelowFields = new Hashtable<>(); // public void addConcreteShadowMungers(Collection c) { // shadowMungers.addAll(c); @@ -237,7 +237,7 @@ public class CrosscuttingMembers { } public Collection<ShadowMunger> getCflowEntries() { - List<ShadowMunger> ret = new ArrayList<ShadowMunger>(); + List<ShadowMunger> 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<ShadowMunger> theseShadowMungers = new HashSet<ShadowMunger>(); - Set<ShadowMunger> theseInlinedAroundMungers = new HashSet<ShadowMunger>(); + Set<ShadowMunger> theseShadowMungers = new HashSet<>(); + Set<ShadowMunger> 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<ShadowMunger> tempSet = new HashSet<ShadowMunger>(); + Set<ShadowMunger> tempSet = new HashSet<>(); tempSet.addAll(other.shadowMungers); - Set<ShadowMunger> otherShadowMungers = new HashSet<ShadowMunger>(); - Set<ShadowMunger> otherInlinedAroundMungers = new HashSet<ShadowMunger>(); + Set<ShadowMunger> otherShadowMungers = new HashSet<>(); + Set<ShadowMunger> 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<Object> theseTypeMungers = new HashSet<Object>(); - Set<Object> otherTypeMungers = new HashSet<Object>(); + Set<Object> theseTypeMungers = new HashSet<>(); + Set<Object> 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<DeclareParents> trimmedThis = new HashSet<DeclareParents>(); + Set<DeclareParents> trimmedThis = new HashSet<>(); for (DeclareParents decp : declareParents) { if (!decp.isMixin()) { trimmedThis.add(decp); } } - Set<DeclareParents> trimmedOther = new HashSet<DeclareParents>(); + Set<DeclareParents> 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<ResolvedType, CrosscuttingMembers> members = new HashMap<ResolvedType, CrosscuttingMembers>(); + private final Map<ResolvedType, CrosscuttingMembers> members = new HashMap<>(); // List of things to be verified once the type system is 'complete' private transient List<IVerificationRequired> 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<ResolvedType> knownAspects = members.keySet(); - Set<ResolvedType> toBeReplaced = new HashSet<ResolvedType>(); + Set<ResolvedType> 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<ShadowMunger> getShadowMungers() { if (shadowMungers == null) { - List<ShadowMunger> ret = new ArrayList<ShadowMunger>(); + List<ShadowMunger> ret = new ArrayList<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getShadowMungers()); } @@ -203,7 +203,7 @@ public class CrosscuttingMembersSet { public List<ConcreteTypeMunger> getTypeMungers() { if (typeMungers == null) { - List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> 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<ConcreteTypeMunger>(); + collected = new ArrayList<>(); } collected.add(typeMunger); } @@ -280,7 +280,7 @@ public class CrosscuttingMembersSet { public List<ConcreteTypeMunger> getLateTypeMungers() { if (lateTypeMungers == null) { - List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> ret = new ArrayList<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getLateTypeMungers()); } @@ -291,11 +291,11 @@ public class CrosscuttingMembersSet { public List<DeclareSoft> getDeclareSofts() { if (declareSofts == null) { - Set<DeclareSoft> ret = new HashSet<DeclareSoft>(); + Set<DeclareSoft> ret = new HashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareSofts()); } - declareSofts = new ArrayList<DeclareSoft>(); + declareSofts = new ArrayList<>(); declareSofts.addAll(ret); } return declareSofts; @@ -303,11 +303,11 @@ public class CrosscuttingMembersSet { public List<DeclareParents> getDeclareParents() { if (declareParents == null) { - Set<DeclareParents> ret = new HashSet<DeclareParents>(); + Set<DeclareParents> ret = new HashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareParents()); } - declareParents = new ArrayList<DeclareParents>(); + declareParents = new ArrayList<>(); declareParents.addAll(ret); } return declareParents; @@ -318,11 +318,11 @@ public class CrosscuttingMembersSet { */ public List<DeclareAnnotation> getDeclareAnnotationOnTypes() { if (declareAnnotationOnTypes == null) { - Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> ret = new LinkedHashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareAnnotationOnTypes()); } - declareAnnotationOnTypes = new ArrayList<DeclareAnnotation>(); + declareAnnotationOnTypes = new ArrayList<>(); declareAnnotationOnTypes.addAll(ret); } return declareAnnotationOnTypes; @@ -333,11 +333,11 @@ public class CrosscuttingMembersSet { */ public List<DeclareAnnotation> getDeclareAnnotationOnFields() { if (declareAnnotationOnFields == null) { - Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> ret = new LinkedHashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareAnnotationOnFields()); } - declareAnnotationOnFields = new ArrayList<DeclareAnnotation>(); + declareAnnotationOnFields = new ArrayList<>(); declareAnnotationOnFields.addAll(ret); } return declareAnnotationOnFields; @@ -348,11 +348,11 @@ public class CrosscuttingMembersSet { */ public List<DeclareAnnotation> getDeclareAnnotationOnMethods() { if (declareAnnotationOnMethods == null) { - Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> ret = new LinkedHashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareAnnotationOnMethods()); } - declareAnnotationOnMethods = new ArrayList<DeclareAnnotation>(); + declareAnnotationOnMethods = new ArrayList<>(); declareAnnotationOnMethods.addAll(ret); // world.sortDeclareAnnotations(declareAnnotationOnMethods); } @@ -364,11 +364,11 @@ public class CrosscuttingMembersSet { */ public List<DeclareTypeErrorOrWarning> getDeclareTypeEows() { if (declareTypeEows == null) { - Set<DeclareTypeErrorOrWarning> ret = new HashSet<DeclareTypeErrorOrWarning>(); + Set<DeclareTypeErrorOrWarning> ret = new HashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareTypeErrorOrWarning()); } - declareTypeEows = new ArrayList<DeclareTypeErrorOrWarning>(); + declareTypeEows = new ArrayList<>(); declareTypeEows.addAll(ret); } return declareTypeEows; @@ -376,7 +376,7 @@ public class CrosscuttingMembersSet { public List<Declare> getDeclareDominates() { if (declareDominates == null) { - List<Declare> ret = new ArrayList<Declare>(); + List<Declare> 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<IVerificationRequired>(); + 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<ResolvedPointcutDefinition> enclosingDefinition = new ArrayList<ResolvedPointcutDefinition>(); + private List<ResolvedPointcutDefinition> 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 <T> Filter<T> dupFilter() { return new Filter<T>() { - final Set<T> seen = new HashSet<T>(); // should have weak ptrs? + final Set<T> seen = new HashSet<>(); // should have weak ptrs? public Iterator<T> filter(final Iterator<T> in) { return new Iterator<T>() { 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<JoinPointSignature> private Member signaturesOfMember; private ResolvedMember firstDefiningMember; private World world; - private List<JoinPointSignature> discoveredSignatures = new ArrayList<JoinPointSignature>(); + private List<JoinPointSignature> discoveredSignatures = new ArrayList<>(); private List<JoinPointSignature> additionalSignatures = Collections.emptyList(); private Iterator<JoinPointSignature> discoveredSignaturesIterator = null; private Iterator<ResolvedType> superTypeIterator = null; private boolean isProxy = false; - private Set<ResolvedType> visitedSuperTypes = new HashSet<ResolvedType>(); + private Set<ResolvedType> visitedSuperTypes = new HashSet<>(); private List<SearchPair> yetToBeProcessedSuperMembers = null; private boolean iteratingOverDiscoveredSignatures = true; @@ -131,7 +131,7 @@ public class JoinPointSignatureIterator implements Iterator<JoinPointSignature> // a common case discoveredSignatures.add(new JoinPointSignature(firstDefiningMember, originalDeclaringType)); } else { - List<ResolvedType> declaringTypes = new ArrayList<ResolvedType>(); + List<ResolvedType> 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<JoinPointSignature> ResolvedMemberImpl foundMember = (ResolvedMemberImpl) superType.lookupResolvedMember(firstDefiningMember, true, isProxy); if (foundMember != null && isVisibleTo(firstDefiningMember, foundMember)) { - List<ResolvedType> declaringTypes = new ArrayList<ResolvedType>(); + List<ResolvedType> 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<JoinPointSignature> member = new JoinPointSignature(foundMember, declaringType); discoveredSignatures.add(member); // for next time we are reset if (additionalSignatures == Collections.EMPTY_LIST) { - additionalSignatures = new ArrayList<JoinPointSignature>(); + additionalSignatures = new ArrayList<>(); } additionalSignatures.add(member); // for this time } @@ -216,12 +216,12 @@ public class JoinPointSignatureIterator implements Iterator<JoinPointSignature> foundMember.declaringType.resolve(world)); discoveredSignatures.add(member); // for next time we are reset if (additionalSignatures == Collections.EMPTY_LIST) { - additionalSignatures = new ArrayList<JoinPointSignature>(); + additionalSignatures = new ArrayList<>(); } additionalSignatures.add(member); // for this time } if (yetToBeProcessedSuperMembers == null) { - yetToBeProcessedSuperMembers = new ArrayList<SearchPair>(); + 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<String, Lint.Kind> kinds = new HashMap<String, Lint.Kind>(); + Map<String, Lint.Kind> 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<UnresolvedType> l = new ArrayList<UnresolvedType>(); + List<UnresolvedType> l = new ArrayList<>(); int i = 1; boolean hasAnyAnglies = sig.indexOf('<') != -1; while (true) { @@ -442,7 +442,7 @@ public class MemberImpl implements Member { public Collection<ResolvedType> getDeclaringTypes(World world) { ResolvedType myType = getDeclaringType().resolve(world); - Collection<ResolvedType> ret = new HashSet<ResolvedType>(); + Collection<ResolvedType> 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<WeakReference<ReferenceType>> derivativeTypes = new ArrayList<WeakReference<ReferenceType>>(); + private final List<WeakReference<ReferenceType>> 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<ResolvedType[]> parameterizedInterfaces = new WeakReference<ResolvedType[]>( + WeakReference<ResolvedType[]> parameterizedInterfaces = new WeakReference<>( null); Collection<Declare> parameterizedDeclares = null; // Collection parameterizedTypeMungers = null; @@ -116,13 +116,13 @@ public class ReferenceType extends ResolvedType { // checkDuplicates(dependent); synchronized (derivativeTypes) { this.derivativeTypes - .add(new WeakReference<ReferenceType>(dependent)); + .add(new WeakReference<>(dependent)); } } public void checkDuplicates(ReferenceType newRt) { synchronized (derivativeTypes) { - List<WeakReference<ReferenceType>> forRemoval = new ArrayList<WeakReference<ReferenceType>>(); + List<WeakReference<ReferenceType>> forRemoval = new ArrayList<>(); for (WeakReference<ReferenceType> 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<ResolvedType[]>( + parameterizedInterfaces = new WeakReference<>( interfaces); return interfaces; } else if (isRawType()) { @@ -778,12 +778,12 @@ public class ReferenceType extends ResolvedType { .parameterizedWith(toUseForParameterization); } } - parameterizedInterfaces = new WeakReference<ResolvedType[]>( + parameterizedInterfaces = new WeakReference<>( interfaces); return interfaces; } if (getDelegate().isCacheable()) { - parameterizedInterfaces = new WeakReference<ResolvedType[]>( + parameterizedInterfaces = new WeakReference<>( delegateInterfaces); } return delegateInterfaces; @@ -937,7 +937,7 @@ public class ReferenceType extends ResolvedType { Collection<Declare> declares = null; if (ajMembersNeedParameterization()) { Collection<Declare> genericDeclares = getDelegate().getDeclares(); - parameterizedDeclares = new ArrayList<Declare>(); + parameterizedDeclares = new ArrayList<>(); Map<String, UnresolvedType> parameterizationMap = getAjMemberParameterizationMap(); for (Declare declareStatement : genericDeclares) { parameterizedDeclares.add(declareStatement.parameterizeWith( @@ -968,7 +968,7 @@ public class ReferenceType extends ResolvedType { return getDelegate().getModifiers(); } - WeakReference<ResolvedType> superclassReference = new WeakReference<ResolvedType>( + WeakReference<ResolvedType> superclassReference = new WeakReference<>( null); @Override @@ -984,7 +984,7 @@ public class ReferenceType extends ResolvedType { getMemberParameterizationMap()).resolve(getWorld()); } if (getDelegate().isCacheable()) { - superclassReference = new WeakReference<ResolvedType>(ret); + superclassReference = new WeakReference<>(ret); } return newSuperclass; } @@ -999,7 +999,7 @@ public class ReferenceType extends ResolvedType { getWorld()); } if (getDelegate().isCacheable()) { - superclassReference = new WeakReference<ResolvedType>(ret); + superclassReference = new WeakReference<>(ret); } return ret; } @@ -1019,7 +1019,7 @@ public class ReferenceType extends ResolvedType { } this.delegate = delegate; synchronized (derivativeTypes) { - List<WeakReference<ReferenceType>> forRemoval = new ArrayList<WeakReference<ReferenceType>>(); + List<WeakReference<ReferenceType>> forRemoval = new ArrayList<>(); for (WeakReference<ReferenceType> 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<ResolvedType>(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<ResolvedType>(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<ResolvedType>(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<WeakReference<ReferenceType>> forRemoval = new ArrayList<WeakReference<ReferenceType>>(); + List<WeakReference<ReferenceType>> forRemoval = new ArrayList<>(); for (WeakReference<ReferenceType> 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<ResolvedType> declaringTypes = new ArrayList<ResolvedType>(); + List<ResolvedType> declaringTypes = new ArrayList<>(); accumulateTypesInBetween(originalDeclaringType, firstDefiningType, declaringTypes); - Set<ResolvedMember> memberSignatures = new LinkedHashSet<ResolvedMember>(); + Set<ResolvedMember> 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<ResolvedType> superTypeIterator = firstDefiningType.getDirectSupertypes(); - List<ResolvedType> typesAlreadyVisited = new ArrayList<ResolvedType>(); + List<ResolvedType> 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<ResolvedType> declaringTypes = new ArrayList<ResolvedType>(); + List<ResolvedType> 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<String, UnresolvedType> typeMap = new HashMap<String, UnresolvedType>(); + Map<String, UnresolvedType> 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<UnresolvedType>()); + 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<String> validBoxing = new HashSet<String>(); + protected static Set<String> validBoxing = new HashSet<>(); static { validBoxing.add("Ljava/lang/Byte;B"); @@ -327,7 +327,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl public Iterator<ResolvedType> getHierarchy(final boolean wantGenerics, final boolean wantDeclaredParents) { final Iterators.Getter<ResolvedType, ResolvedType> interfaceGetter = new Iterators.Getter<ResolvedType, ResolvedType>() { - List<String> alreadySeen = new ArrayList<String>(); // Strings are signatures (ResolvedType.getSignature()) + List<String> alreadySeen = new ArrayList<>(); // Strings are signatures (ResolvedType.getSignature()) @Override public Iterator<ResolvedType> 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<Integer> forRemoval = new ArrayList<Integer>(); + List<Integer> 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<ResolvedMember> getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) { - List<ResolvedMember> methods = new ArrayList<ResolvedMember>(); - Set<String> knowninterfaces = new HashSet<String>(); + List<ResolvedMember> methods = new ArrayList<>(); + Set<String> 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<ResolvedType> getHierarchyWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) { - List<ResolvedType> types = new ArrayList<ResolvedType>(); - Set<String> visited = new HashSet<String>(); + List<ResolvedType> types = new ArrayList<>(); + Set<String> 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<ResolvedType> typesTolookat = new ArrayList<ResolvedType>(); + List<ResolvedType> 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<Declare> ret = new ArrayList<Declare>(); + List<Declare> 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<ShadowMunger> acc = new ArrayList<ShadowMunger>(); + List<ShadowMunger> acc = new ArrayList<>(); final Iterators.Filter<ResolvedType> dupFilter = Iterators.dupFilter(); Iterators.Getter<ResolvedType, ResolvedType> typeGetter = new Iterators.Getter<ResolvedType, ResolvedType>() { @Override @@ -987,7 +987,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return Collections.emptyMap(); } TypeVariable[] tvs = getGenericType().getTypeVariables(); - Map<String, UnresolvedType> parameterizationMap = new HashMap<String, UnresolvedType>(); + Map<String, UnresolvedType> 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<ShadowMunger> getDeclaredAdvice() { - List<ShadowMunger> l = new ArrayList<ShadowMunger>(); + List<ShadowMunger> 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<ResolvedMember> l = new ArrayList<ResolvedMember>(); + List<ResolvedMember> 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<ConcreteTypeMunger> interTypeMungers = new ArrayList<ConcreteTypeMunger>(); + protected List<ConcreteTypeMunger> interTypeMungers = new ArrayList<>(); public List<ConcreteTypeMunger> getInterTypeMungers() { return interTypeMungers; } public List<ConcreteTypeMunger> getInterTypeParentMungers() { - List<ConcreteTypeMunger> l = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> 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<ConcreteTypeMunger> getInterTypeMungersIncludingSupers() { - ArrayList<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + ArrayList<ConcreteTypeMunger> ret = new ArrayList<>(); collectInterTypeMungers(ret); return ret; } public List<ConcreteTypeMunger> getInterTypeParentMungersIncludingSupers() { - ArrayList<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + ArrayList<ConcreteTypeMunger> ret = new ArrayList<>(); collectInterTypeParentMungers(ret); return ret; } @@ -2311,8 +2311,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl private Getter<ResolvedType, ResolvedType> ifaceGetter; Iterator<ResolvedType> delegate = null; - public Queue<ResolvedType> toPersue = new LinkedList<ResolvedType>(); - public Set<ResolvedType> visited = new HashSet<ResolvedType>(); + public Queue<ResolvedType> toPersue = new LinkedList<>(); + public Set<ResolvedType> visited = new HashSet<>(); SuperInterfaceWalker(Iterators.Getter<ResolvedType, ResolvedType> 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<ConcreteTypeMunger>(); + interTypeMungers = new ArrayList<>(); } public boolean isTopmostImplementor(ResolvedType interfaceType) { @@ -2410,7 +2410,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } public List<ResolvedMember> getExposedPointcuts() { - List<ResolvedMember> ret = new ArrayList<ResolvedMember>(); + List<ResolvedMember> 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<ResolvedMember> readSuperMethodsCalled(VersionedDataInputStream s) throws IOException { - Set<ResolvedMember> ret = new HashSet<ResolvedMember>(); + Set<ResolvedMember> 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<ResolvedMember> ret = new ArrayList<ResolvedMember>(superMethodsCalled); + List<ResolvedMember> 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<String> aliases = new ArrayList<String>(); + List<String> 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<ShadowMunger>(); + 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<String> clashingAspects = new HashSet<String>(); + Set<String> 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<Kind> toSet(int i) { - Set<Kind> results = new HashSet<Kind>(); + Set<Kind> 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<ResolvedType>(); + 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<String> targets = new HashSet<String>(); + Set<String> 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<AnnotationNameValuePair>(); + 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<UnresolvedType> types = new ArrayList<UnresolvedType>(); + List<UnresolvedType> 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<Entry>(), false, reweavable, reweavableCompressedModeDefault, reweavableDiffModeDefault); + this(new ArrayList<>(), false, reweavable, reweavableCompressedModeDefault, reweavableDiffModeDefault); } private WeaverStateInfo(List<Entry> 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<String>(); + this.aspectsAffectingType = new HashSet<>(); this.unwovenClassFile = null; } @@ -147,7 +147,7 @@ public class WeaverStateInfo { } int n = s.readShort(); - List<Entry> l = new ArrayList<Entry>(); + List<Entry> 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<ConcreteTypeMunger> getTypeMungers(ResolvedType onType) { World world = onType.getWorld(); - List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> 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<RuntimeException>(); + 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<String, ResolvedType> tMap = new HashMap<String, ResolvedType>(); + final Map<String, ResolvedType> tMap = new HashMap<>(); // Map of types that may be ejected from the cache if we need space final Map<String, Reference<ResolvedType>> expendableMap = Collections - .synchronizedMap(new WeakHashMap<String, Reference<ResolvedType>>()); + .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<ResolvedType> rq = new ReferenceQueue<ResolvedType>(); + private final ReferenceQueue<ResolvedType> 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<String>(); - writtenClasses = new ArrayList<String>(); + 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<String> forRemoval = new ArrayList<String>(); + List<String> 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<ResolvedType>(type)); + expendableMap.put(key, new SoftReference<>(type)); } else { - expendableMap.put(key, new WeakReference<ResolvedType>(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<ResolvedType>(type, rq)); + expendableMap.put(key, new WeakReference<>(type, rq)); } else { - expendableMap.put(key, new WeakReference<ResolvedType>(type)); + expendableMap.put(key, new WeakReference<>(type)); } } else if (policy == USE_SOFT_REFS) { if (memoryProfiling) { - expendableMap.put(key, new SoftReference<ResolvedType>(type, rq)); + expendableMap.put(key, new SoftReference<>(type, rq)); } else { - expendableMap.put(key, new SoftReference<ResolvedType>(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<PrecedenceCacheKey, Integer>(); + 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<Class<?>, TypeVariable[]> workInProgress1 = new HashMap<Class<?>, TypeVariable[]>(); + private final Map<Class<?>, 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<PointcutDesignatorHandler>(); + 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<ResolvedType, Set<ResolvedType>> exclusionMap = new HashMap<ResolvedType, Set<ResolvedType>>(); + private Map<ResolvedType, Set<ResolvedType>> exclusionMap = new HashMap<>(); public Map<ResolvedType, Set<ResolvedType>> getExclusionMap() { return exclusionMap; @@ -1886,10 +1886,10 @@ public abstract class World implements Dump.INode { long typeCount; long perJoinpointCount; long perTypes; - Map<String, Long> joinpointsPerPointcut = new HashMap<String, Long>(); - Map<String, Long> timePerPointcut = new HashMap<String, Long>(); - Map<String, Long> fastMatchTimesPerPointcut = new HashMap<String, Long>(); - Map<String, Long> fastMatchTypesPerPointcut = new HashMap<String, Long>(); + Map<String, Long> joinpointsPerPointcut = new HashMap<>(); + Map<String, Long> timePerPointcut = new HashMap<>(); + Map<String, Long> fastMatchTimesPerPointcut = new HashMap<>(); + Map<String, Long> 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<String, Long>(); - this.timePerPointcut = new HashMap<String, Long>(); + 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<ExactTypePattern> getExactDeclaringTypes() { if (exactDeclaringTypes == null) { - exactDeclaringTypes = new ArrayList<ExactTypePattern>(); + 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<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingPattern) { // BindingAnnotationTypePattern) { - List<BindingPattern> l = new ArrayList<BindingPattern>(); + List<BindingPattern> 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<BindingPattern> getBindingAnnotationTypePatterns() { - List<BindingPattern> l = new ArrayList<BindingPattern>(); + List<BindingPattern> 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<BindingTypePattern> getBindingTypePatterns() { - List<BindingTypePattern> l = new ArrayList<BindingTypePattern>(); + List<BindingTypePattern> 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<BasicToken> tokens = new ArrayList<BasicToken>(); + List<BasicToken> 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<ShadowMunger> innerCflowEntries = new ArrayList<ShadowMunger>(xcut.getCflowEntries()); + List<ShadowMunger> 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<Slot> slots = new ArrayList<Slot>(); + List<Slot> 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<String>(); + this.annotationMethods = new ArrayList<>(); annotationMethods.add("unknown"); - this.annotationStrings = new ArrayList<String>(); + this.annotationStrings = new ArrayList<>(); annotationStrings.add("@<annotation>"); } 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<ResolvedType> ret = new ArrayList<ResolvedType>(); + List<ResolvedType> 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<String, String> aValues = new HashMap<String, String>(); + Map<String, String> 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<String, Class<?>> boxedTypesMap; static { - primitiveTypesMap = new HashMap<String, Class<?>>(); + 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<String, Class<?>>(); + 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<String, Class<?>>(); + 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<Var> args = new ArrayList<Var>(); + List<Var> 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<String, Integer> modifierFlags = null; static { - modifierFlags = new HashMap<String, Integer>(); + 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<ExactTypePattern> getExactDeclaringTypes() { if (exactDeclaringTypes == null) { - exactDeclaringTypes = new ArrayList<ExactTypePattern>(); + 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<TypePattern> l = new ArrayList<TypePattern>(); + List<TypePattern> l = new ArrayList<>(); do { l.add(parseTypePattern()); } while (maybeEat(",")); @@ -282,7 +282,7 @@ public class PatternParser { } boolean isExtends = t.getString().equals("extends"); - List<TypePattern> l = new ArrayList<TypePattern>(); + List<TypePattern> l = new ArrayList<>(); do { l.add(parseTypePattern()); } while (maybeEat(",")); @@ -679,7 +679,7 @@ public class PatternParser { } public List<String> parseDottedIdentifier() { - List<String> ret = new ArrayList<String>(); + List<String> 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<String, String> parseAnnotationValues() { - Map<String, String> values = new HashMap<String, String>(); + Map<String, String> values = new HashMap<>(); boolean seenDefaultValue = false; do { String possibleKeyString = parseAnnotationNameValuePattern(); @@ -1133,7 +1133,7 @@ public class PatternParser { } public TypePattern parseGenericsWildcardTypePattern() { - List<NamePattern> names = new ArrayList<NamePattern>(); + List<NamePattern> names = new ArrayList<>(); names.add(new NamePattern("?")); TypePattern upperBound = null; TypePattern[] additionalInterfaceBounds = new TypePattern[0]; @@ -1242,7 +1242,7 @@ public class PatternParser { // } public List<NamePattern> parseDottedNamePattern() { - List<NamePattern> names = new ArrayList<NamePattern>(); + List<NamePattern> 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<TypePattern> patterns = new ArrayList<TypePattern>(); + List<TypePattern> patterns = new ArrayList<>(); eat("("); // () @@ -1485,7 +1485,7 @@ public class PatternParser { } public AnnotationPatternList parseArgumentsAnnotationPattern() { - List<AnnotationTypePattern> patterns = new ArrayList<AnnotationTypePattern>(); + List<AnnotationTypePattern> 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<TypePattern> required = new ArrayList<TypePattern>(); - List<TypePattern> forbidden = new ArrayList<TypePattern>(); + List<TypePattern> required = new ArrayList<>(); + List<TypePattern> 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<TypeVariablePattern> typeVars = new ArrayList<TypeVariablePattern>(); + List<TypeVariablePattern> typeVars = new ArrayList<>(); TypeVariablePattern t = parseTypeVariable(); typeVars.add(t); while (maybeEat(",")) { @@ -1712,7 +1712,7 @@ public class PatternParser { if (!maybeEat("<")) { return null; } - List<String> typeVarNames = new ArrayList<String>(); + List<String> typeVarNames = new ArrayList<>(); do { typeVarNames.add(parseIdentifier()); } while (maybeEat(",")); @@ -1726,7 +1726,7 @@ public class PatternParser { if (!maybeEat("<")) { return null; } - List<TypePattern> typePats = new ArrayList<TypePattern>(); + List<TypePattern> typePats = new ArrayList<>(); do { TypePattern tp = parseTypePattern(true, false); typePats.add(tp); @@ -1752,7 +1752,7 @@ public class PatternParser { } private TypePattern[] maybeParseAdditionalInterfaceBounds() { - List<TypePattern> boundsList = new ArrayList<TypePattern>(); + List<TypePattern> 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<ShadowMunger> innerCflowEntries = new ArrayList<ShadowMunger>(xcut.getCflowEntries()); + List<ShadowMunger> 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<Pointcut> nodes = new TreeSet<Pointcut>(new PointcutEvaluationExpenseComparator()); + SortedSet<Pointcut> 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<Pointcut> nodes = new TreeSet<Pointcut>(new PointcutEvaluationExpenseComparator()); + SortedSet<Pointcut> nodes = new TreeSet<>(new PointcutEvaluationExpenseComparator()); collectOrNodes(pc, nodes); // write out with cheapest on left Iterator<Pointcut> 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<String, UnresolvedType>(); + 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<String, UnresolvedType>(); + 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<ExactAnnotationTypePattern, AnnotationTargetKind[]> incorrectTargetKinds = new HashMap<ExactAnnotationTypePattern, AnnotationTargetKind[]>(); + private Map<ExactAnnotationTypePattern, AnnotationTargetKind[]> 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<AnnotationTargetKind> incorrectTargets = new ArrayList<AnnotationTargetKind>(); + List<AnnotationTargetKind> 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<ExactTypePattern> getExactDeclaringTypes() { if (declaringType instanceof ExactTypePattern) { - List<ExactTypePattern> l = new ArrayList<ExactTypePattern>(); + List<ExactTypePattern> 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<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List<BindingPattern> l = new ArrayList<BindingPattern>(); + List<BindingPattern> 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<BindingTypePattern> getBindingTypePatterns() { if (typePattern instanceof BindingTypePattern) { - List<BindingTypePattern> l = new ArrayList<BindingTypePattern>(); + List<BindingTypePattern> 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<UnresolvedType> getExactTypes() { - List<UnresolvedType> ret = new ArrayList<UnresolvedType>(); + List<UnresolvedType> 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<Question,FuzzyBoolean> questionsAndAnswers = new HashMap<Question,FuzzyBoolean>(); + private Map<Question,FuzzyBoolean> 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<String,String> replacementValues = new HashMap<String,String>(); + Map<String,String> replacementValues = new HashMap<>(); Set<String> 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<String, String> aValues = new HashMap<String, String>(); + Map<String, String> 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<char[]> ret = new ArrayList<char[]>(); + List<char[]> 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<char[]> ret = new ArrayList<char[]>(); + List<char[]> 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<String> ret = new ArrayList<String>(); + List<String> 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<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List<BindingPattern> l = new ArrayList<BindingPattern>(); + List<BindingPattern> 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<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List<BindingPattern> l = new ArrayList<BindingPattern>(); + List<BindingPattern> 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<WeakClassLoaderReference, ReflectionWorld> rworlds = Collections.synchronizedMap(new HashMap<WeakClassLoaderReference, ReflectionWorld>()); + private static Map<WeakClassLoaderReference, ReflectionWorld> rworlds = Collections.synchronizedMap(new HashMap<>()); private WeakClassLoaderReference classLoaderReference; private AnnotationFinder annotationFinder; private boolean mustUseOneFourDelegates = false; // for testing - private Map<String,Class<?>> inProgressResolutionClasses = new HashMap<String,Class<?>>(); + private Map<String,Class<?>> 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<PointcutPrimitive> supportedPrimitives; - private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<PointcutDesignatorHandler>(); + private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<>(); /** * @return a Set containing every PointcutPrimitive except if, cflow, and cflowbelow (useful for passing to PointcutParser * constructor). */ public static Set<PointcutPrimitive> getAllSupportedPointcutPrimitives() { - Set<PointcutPrimitive> primitives = new HashSet<PointcutPrimitive>(); + Set<PointcutPrimitive> 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<PointcutPrimitive> supportedPrimitives; - private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<PointcutDesignatorHandler>(); + private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<>(); /** * @return a Set containing every PointcutPrimitive except if, cflow, and cflowbelow (useful for passing to PointcutParser * constructor). */ public static Set<PointcutPrimitive> getAllSupportedPointcutPrimitives() { - Set<PointcutPrimitive> primitives = new HashSet<PointcutPrimitive>(); + Set<PointcutPrimitive> 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<ResolvedType> lowerTys = new ArrayList<ResolvedType>(Arrays.asList(lowerTyArray)); + List<ResolvedType> lowerTys = new ArrayList<>(Arrays.asList(lowerTyArray)); lowerTys.add(ty); - Set<ResolvedType> allLowerTys = new HashSet<ResolvedType>(lowerTys); - Set<ResolvedType> allUpperTys = new HashSet<ResolvedType>(Arrays.asList(primitives)); + Set<ResolvedType> allLowerTys = new HashSet<>(lowerTys); + Set<ResolvedType> 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<String> l = new ArrayList<String>(); + List<String> 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<String> list = new ArrayList<String>(); + List<String> 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<String,String> m = watp.annotationValues; Set<String> keys = m.keySet(); - List<String> orderedKeys = new ArrayList<String>(); + List<String> 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<T> implements AjType<T> { */ public Field[] getDeclaredFields() { Field[] fields = clazz.getDeclaredFields(); - List<Field> filteredFields = new ArrayList<Field>(); + List<Field> filteredFields = new ArrayList<>(); for (Field field : fields) if (!field.getName().startsWith(ajcMagic) && !field.isAnnotationPresent(DeclareWarning.class) @@ -296,7 +296,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Field[] getFields() { Field[] fields = clazz.getFields(); - List<Field> filteredFields = new ArrayList<Field>(); + List<Field> filteredFields = new ArrayList<>(); for (Field field : fields) if (!field.getName().startsWith(ajcMagic) && !field.isAnnotationPresent(DeclareWarning.class) @@ -331,7 +331,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Method[] getDeclaredMethods() { Method[] methods = clazz.getDeclaredMethods(); - List<Method> filteredMethods = new ArrayList<Method>(); + List<Method> filteredMethods = new ArrayList<>(); for (Method method : methods) { if (isReallyAMethod(method)) filteredMethods.add(method); } @@ -345,7 +345,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Method[] getMethods() { Method[] methods = clazz.getMethods(); - List<Method> filteredMethods = new ArrayList<Method>(); + List<Method> filteredMethods = new ArrayList<>(); for (Method method : methods) { if (isReallyAMethod(method)) filteredMethods.add(method); } @@ -391,7 +391,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Pointcut[] getDeclaredPointcuts() { if (declaredPointcuts != null) return declaredPointcuts; - List<Pointcut> pointcuts = new ArrayList<Pointcut>(); + List<Pointcut> pointcuts = new ArrayList<>(); Method[] methods = clazz.getDeclaredMethods(); for (Method method : methods) { Pointcut pc = asPointcut(method); @@ -408,7 +408,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Pointcut[] getPointcuts() { if (pointcuts != null) return pointcuts; - List<Pointcut> pcuts = new ArrayList<Pointcut>(); + List<Pointcut> pcuts = new ArrayList<>(); Method[] methods = clazz.getMethods(); for (Method method : methods) { Pointcut pc = asPointcut(method); @@ -465,7 +465,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ private Advice[] getDeclaredAdvice(Set ofAdviceTypes) { if (declaredAdvice == null) initDeclaredAdvice(); - List<Advice> adviceList = new ArrayList<Advice>(); + List<Advice> adviceList = new ArrayList<>(); for (Advice a : declaredAdvice) { if (ofAdviceTypes.contains(a.getKind())) adviceList.add(a); } @@ -476,7 +476,7 @@ public class AjTypeImpl<T> implements AjType<T> { private void initDeclaredAdvice() { Method[] methods = clazz.getDeclaredMethods(); - List<Advice> adviceList = new ArrayList<Advice>(); + List<Advice> adviceList = new ArrayList<>(); for (Method method : methods) { Advice advice = asAdvice(method); if (advice != null) adviceList.add(advice); @@ -490,7 +490,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ private Advice[] getAdvice(Set ofAdviceTypes) { if (advice == null) initAdvice(); - List<Advice> adviceList = new ArrayList<Advice>(); + List<Advice> adviceList = new ArrayList<>(); for (Advice a : advice) { if (ofAdviceTypes.contains(a.getKind())) adviceList.add(a); } @@ -501,7 +501,7 @@ public class AjTypeImpl<T> implements AjType<T> { private void initAdvice() { Method[] methods = clazz.getMethods(); - List<Advice> adviceList = new ArrayList<Advice>(); + List<Advice> adviceList = new ArrayList<>(); for (Method method : methods) { Advice advice = asAdvice(method); if (advice != null) adviceList.add(advice); @@ -584,7 +584,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public InterTypeMethodDeclaration[] getDeclaredITDMethods() { if (this.declaredITDMethods == null) { - List<InterTypeMethodDeclaration> itdms = new ArrayList<InterTypeMethodDeclaration>(); + List<InterTypeMethodDeclaration> 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<T> implements AjType<T> { public InterTypeMethodDeclaration[] getITDMethods() { if (this.itdMethods == null) { - List<InterTypeMethodDeclaration> itdms = new ArrayList<InterTypeMethodDeclaration>(); + List<InterTypeMethodDeclaration> 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<T> implements AjType<T> { public InterTypeConstructorDeclaration[] getDeclaredITDConstructors() { if (this.declaredITDCons == null) { - List<InterTypeConstructorDeclaration> itdcs = new ArrayList<InterTypeConstructorDeclaration>(); + List<InterTypeConstructorDeclaration> 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<T> implements AjType<T> { public InterTypeConstructorDeclaration[] getITDConstructors() { if (this.itdCons == null) { - List<InterTypeConstructorDeclaration> itdcs = new ArrayList<InterTypeConstructorDeclaration>(); + List<InterTypeConstructorDeclaration> 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<T> implements AjType<T> { } public InterTypeFieldDeclaration[] getDeclaredITDFields() { - List<InterTypeFieldDeclaration> itdfs = new ArrayList<InterTypeFieldDeclaration>(); + List<InterTypeFieldDeclaration> itdfs = new ArrayList<>(); if (this.declaredITDFields == null) { Method[] baseMethods = clazz.getDeclaredMethods(); for(Method m : baseMethods) { @@ -826,7 +826,7 @@ public class AjTypeImpl<T> implements AjType<T> { } public InterTypeFieldDeclaration[] getITDFields() { - List<InterTypeFieldDeclaration> itdfs = new ArrayList<InterTypeFieldDeclaration>(); + List<InterTypeFieldDeclaration> itdfs = new ArrayList<>(); if (this.itdFields == null) { Method[] baseMethods = clazz.getMethods(); for(Method m : baseMethods) { @@ -857,7 +857,7 @@ public class AjTypeImpl<T> implements AjType<T> { } public DeclareErrorOrWarning[] getDeclareErrorOrWarnings() { - List<DeclareErrorOrWarning> deows = new ArrayList<DeclareErrorOrWarning>(); + List<DeclareErrorOrWarning> deows = new ArrayList<>(); for (Field field : clazz.getDeclaredFields()) { try { if (field.isAnnotationPresent(DeclareWarning.class)) { @@ -894,7 +894,7 @@ public class AjTypeImpl<T> implements AjType<T> { } public DeclareParents[] getDeclareParents() { - List<DeclareParents> decps = new ArrayList<DeclareParents>(); + List<DeclareParents> 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<T> implements AjType<T> { } public DeclareSoft[] getDeclareSofts() { - List<DeclareSoft> decs = new ArrayList<DeclareSoft>(); + List<DeclareSoft> 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<T> implements AjType<T> { } public DeclareAnnotation[] getDeclareAnnotations() { - List<DeclareAnnotation> decAs = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> 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<T> implements AjType<T> { } public DeclarePrecedence[] getDeclarePrecedence() { - List<DeclarePrecedence> decps = new ArrayList<DeclarePrecedence>(); + List<DeclarePrecedence> 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<Class, WeakReference<AjType>> ajTypes = - Collections.synchronizedMap(new WeakHashMap<Class,WeakReference<AjType>>()); + 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<T>(fromClass); - ajTypes.put(fromClass, new WeakReference<AjType>(theAjType)); + theAjType = new AjTypeImpl<>(fromClass); + ajTypes.put(fromClass, new WeakReference<>(theAjType)); return theAjType; } } // neither key nor value was found - AjType<T> theAjType = new AjTypeImpl<T>(fromClass); - ajTypes.put(fromClass, new WeakReference<AjType>(theAjType)); + AjType<T> 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<AroundClosure>(); + 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<CompilerArg>(); + 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<FileSet> fileSets = new Vector<FileSet>(); + private Vector<FileSet> 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<Link>(); - groups = new ArrayList<Group>(); + 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<String>(); + sourcefiles = new ArrayList<>(); Enumeration<FileSet> 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<String>() : + packagenames = new ArrayList<>() : packagenames).addAll(strings(list, true)); } @@ -264,7 +264,7 @@ public class Ajdoc extends MatchingTask { public List<File> createArgfiles() { return (argfiles == null ? - argfiles = new ArrayList<File>() : + argfiles = new ArrayList<>() : argfiles); } @@ -480,7 +480,7 @@ public class Ajdoc extends MatchingTask { public class Doclet { protected String name; protected Path path; - protected List<Param> params = new ArrayList<Param>(); + protected List<Param> params = new ArrayList<>(); public Doclet() {} public void setName(String name) { this.name = name; @@ -617,7 +617,7 @@ public class Ajdoc extends MatchingTask { } } } - Map<String,List<String>> groupMap = new HashMap<String,List<String>>(); + Map<String,List<String>> 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<String> packages = groupMap.get(group.title); if (packages == null) { - packages = new ArrayList<String>(); + packages = new ArrayList<>(); } packages.addAll(group.packages); groupMap.put(group.title, packages); @@ -719,7 +719,7 @@ public class Ajdoc extends MatchingTask { protected final <T> List<T> list(String str, Mapper<T> mapper) { if (str == null) return Collections.emptyList(); - List<T> list = new ArrayList<T>(); + List<T> 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<String> finalList(String[] args) { - List<String> result = new ArrayList<String>(); + List<String> 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<List<Arg>> combinations(List<Argument> arglist) { List<List<Arg>> result = new Vector<>(); - result.add(new Vector<Arg>()); + 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<ITestStep> testSteps = new ArrayList<ITestStep>(); + private List<ITestStep> 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<String,AjcTest> testMap = new HashMap<String,AjcTest>(); + private Map<String,AjcTest> 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<ExpectedMessageSpec> expected = new ArrayList<ExpectedMessageSpec>(); + private List<ExpectedMessageSpec> expected = new ArrayList<>(); private String files; private boolean includeClassesDir; @@ -266,8 +266,8 @@ public class CompileSpec implements ITestStep { args.append(getExtdirs()); args.append(" "); } - List<String> fileList = new ArrayList<String>(); - List<String> jarList = new ArrayList<String>(); + List<String> fileList = new ArrayList<>(); + List<String> 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<AjcTestCase.Message> infos = null; - List<AjcTestCase.Message> warnings = new ArrayList<AjcTestCase.Message>(); - List<AjcTestCase.Message> errors = new ArrayList<AjcTestCase.Message>(); - List<AjcTestCase.Message> fails = new ArrayList<AjcTestCase.Message>(); - List<AjcTestCase.Message> weaveInfos = new ArrayList<AjcTestCase.Message>(); + List<AjcTestCase.Message> warnings = new ArrayList<>(); + List<AjcTestCase.Message> errors = new ArrayList<>(); + List<AjcTestCase.Message> fails = new ArrayList<>(); + List<AjcTestCase.Message> weaveInfos = new ArrayList<>(); for (ExpectedMessageSpec exMsg: expected) { String kind = exMsg.getKind(); if (kind.equals("info")) { - if (infos == null) infos = new ArrayList<AjcTestCase.Message>(); + 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<AjcTest> tests = new ArrayList<AjcTest>(); + private List<AjcTest> 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<String> expectedOutputLines = new ArrayList<String>(); + private List<String> 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<String> expected = new ArrayList<String>(); + List<String> expected = new ArrayList<>(); expected.addAll(expectedOutputLines); - List<String> found = new ArrayList<String>(); + List<String> found = new ArrayList<>(); found.addAll(outputFound); for (String lineFound : outputFound) { for (String lineExpected : expectedOutputLines) { @@ -119,7 +119,7 @@ public class OutputSpec { } private List<String> getOutputFound(String output) { - List<String> found = new ArrayList<String>(); + List<String> 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<ExpectedMessageSpec> expected = new ArrayList<ExpectedMessageSpec>(); + private List<ExpectedMessageSpec> 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<File>(); + 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<File> classFiles = new ArrayList<File>(); + List<File> classFiles = new ArrayList<>(); List<File> toExclude = isClasses ? Collections.<File>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<String,AjcTest> testMap = new HashMap<String,AjcTest>(); + private static Map<String,AjcTest> testMap = new HashMap<>(); private static boolean suiteLoaded = false; private AjcTest currentTest = null; - private Stack<Boolean> clearTestAfterRun = new Stack<Boolean>(); + private Stack<Boolean> 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<String,AjcTest>(); + 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<LocalVariable> sortedLocalVariables(LocalVariableTable lvt) { - List<LocalVariable> l = new ArrayList<LocalVariable>(); + List<LocalVariable> 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<String>(); - paths = new ArrayList<String>(); + options = new ArrayList<>(); + paths = new ArrayList<>(); // XXXXXunused sourceLocations = new ArrayList(); - keywords = new ArrayList<String>(); - children = new ArrayList<IRunSpec>(); + 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<IRunSpec> getWorkingChildren() { if (skipAll) { - return new ArrayList<IRunSpec>(); + return new ArrayList<>(); } if (null == skipSet) { return getChildren(); } - ArrayList<IRunSpec> result = new ArrayList<IRunSpec>(); + ArrayList<IRunSpec> result = new ArrayList<>(); int i = 0; for (Iterator<IRunSpec> iter = children.listIterator(); iter.hasNext(); i++) { IRunSpec child = iter.next(); @@ -700,7 +700,7 @@ abstract public class AbstractRunSpec implements IRunSpec { } private <T> ArrayList<T> makeList(List<T> list) { - ArrayList<T> result = new ArrayList<T>(); + ArrayList<T> result = new ArrayList<>(); if (null != list) { result.addAll(list); } @@ -779,7 +779,7 @@ abstract public class AbstractRunSpec implements IRunSpec { final private ArrayList<String> parentOptions; public RT() { - parentOptions = new ArrayList<String>(); + 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<String> result = new ArrayList<String>(); + ArrayList<String> 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<String,List<String>> TITLES = new HashMap<String,List<String>>(); + private static final Map<String,List<String>> TITLES = new HashMap<>(); private static List<String> 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<String> parseTitlesList(String titlesList) { - ArrayList<String> result = new ArrayList<String>(); + ArrayList<String> 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<String> readTitlesFile(File titlesFile, boolean fail) { - ArrayList<String> result = new ArrayList<String>(); + ArrayList<String> 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<File> tempFiles = new ArrayList<File>(); + static ArrayList<File> 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<String> list = new ArrayList<String>(); + ArrayList<String> 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<File> files = new Vector<File>(); + Vector<File> 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<IMessage> sink = new ArrayList<IMessage>(); + ArrayList<IMessage> 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<Link>(); - checkedUrls = new ArrayList<String>(); - refsToCheck = new ArrayList<String>(); - validRefs = new ArrayList<String>(); + 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<Link> list = new ArrayList<Link>(); + ArrayList<Link> 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<IProgramElement> files = new ArrayList<IProgramElement>(); + List<IProgramElement> 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<File> tempFiles = new ArrayList<File>(); + ArrayList<File> 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<File> toDelete = new ArrayList<File>(); + final ArrayList<File> 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<File> toDelete = new ArrayList<File>(); + ArrayList<File> 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<ShadowMunger> allShadowMungers = new ArrayList<ShadowMunger>(); - Collection<ConcreteTypeMunger> allTypeMungers = new ArrayList<ConcreteTypeMunger>(); + Collection<ShadowMunger> allShadowMungers = new ArrayList<>(); + Collection<ConcreteTypeMunger> allTypeMungers = new ArrayList<>(); public Collection<ShadowMunger> createCustomShadowMungers(ResolvedType aspectType) { - List<ShadowMunger> mungers = new ArrayList<ShadowMunger>(); + List<ShadowMunger> 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<ConcreteTypeMunger> createCustomTypeMungers(ResolvedType aspectType) { - List<ConcreteTypeMunger> mungers = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> 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<String> filesForCompilation = new ArrayList<String>(); + List<String> 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<String> l = new ArrayList<String>(); + List<String> 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<File> s = new HashSet<File>(); + Set<File> 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<File> s = new HashSet<File>(); + Set<File> 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<String> currentFiles = icc.getProjectSourceFiles(); - List<String> filesForCompilation = new ArrayList<String>(); + List<String> 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<String> currentXmlFiles = icc.getProjectXmlConfigFiles(); - List<String> collector = new ArrayList<String>(); + List<String> 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<String> detectedDeletions = new ArrayList<String>(); + public static List<String> 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<String, String> javaOptions = new Hashtable<String, String>(); + Hashtable<String, String> 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<String, String> javaOptions = new Hashtable<String, String>(); + Hashtable<String, String> 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<String, String> javaOptions = new Hashtable<String, String>(); + Hashtable<String, String> 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<String> compiledFiles = new ArrayList<String>(getCompiledFiles(projectName)); + List<String> 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<String> compiledFiles = new ArrayList<String>(); - private List<String> wovenClasses = new ArrayList<String>(); + private List<String> compiledFiles = new ArrayList<>(); + private List<String> 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<String, String> ht = new Hashtable<String, String>(); + Hashtable<String, String> 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<String>(); + 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<File>(); + 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<String>(); + 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<IMessage>(); - warningMessages = new ArrayList<IMessage>(); - weavingMessages = new ArrayList<IMessage>(); + 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<String,File> m = new HashMap<String,File>(); + Map<String,File> 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<String,String> javaOptions = new Hashtable<String,String>(); + Hashtable<String,String> 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<File> s = new HashSet<File>(); + Set<File> 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<String> viaIteratorList = exhaustTypeIterator(typeA.getHierarchy(wantGenerics, false)); List<ResolvedType> typeDirectlyList = typeA.getHierarchyWithoutIterator(true, true, wantGenerics); assertFalse(viaIteratorList.isEmpty()); - List<String> directlyList = new ArrayList<String>(); + List<String> 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<ResolvedMember> getThemAll(Iterator<ResolvedMember> methods) { - List<ResolvedMember> allOfThem = new ArrayList<ResolvedMember>(); + List<ResolvedMember> allOfThem = new ArrayList<>(); while (methods.hasNext()) { allOfThem.add(methods.next()); } @@ -2260,7 +2260,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa } private List<String> exhaustTypeIterator(Iterator<ResolvedType> types) { - List<String> allOfThem = new ArrayList<String>(); + List<String> 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<String, String> javaOptions = new Hashtable<String, String>(); + Hashtable<String, String> 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<String, String> javaOptions = new Hashtable<String, String>(); + Hashtable<String, String> 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<String, String> javaOptions = new Hashtable<String, String>(); + Hashtable<String, String> 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<File> s = new HashSet<File>(); + Set<File> 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<File> s = new HashSet<File>(); + Set<File> 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<File> s = new HashSet<File>(); + Set<File> 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<File> s = new HashSet<File>(); + Set<File> s = new HashSet<>(); s.add(f); - Map<File, String> m = new HashMap<File, String>(); + Map<File, String> 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<String> targets = element.getTargets(); if (output == null) { - output = new ArrayList<String>(); + 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<String> fileContents = new ArrayList<String>(); + List<String> 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<String> expectedFileContents = new ArrayList<String>(); + List<String> 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<String> foundFileContents = new ArrayList<String>(); + List<String> 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<String> result = new ArrayList<String>(); + ArrayList<String> 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<File> result = new ArrayList<File>(); + ArrayList<File> 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<File> listClassFiles(File dir) { - ArrayList<File> result = new ArrayList<File>(); + ArrayList<File> 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<File> list = new ArrayList<File>(); + ArrayList<File> 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<String> result = new ArrayList<String>(); + ArrayList<String> 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<String> makeClasspath(URL[] urls) { - List<String> ret = new LinkedList<String>(); + List<String> 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<FormalTypeParameter> formalTypeParametersList = new ArrayList<FormalTypeParameter>(); + List<FormalTypeParameter> formalTypeParametersList = new ArrayList<>(); do { formalTypeParametersList.add(parseFormalTypeParameter()); } while (!maybeEat(">")); @@ -54,7 +54,7 @@ public class GenericSignatureParser { formalTypeParametersList.toArray(classSig.formalTypeParameters); } classSig.superclassSignature = parseClassTypeSignature(); - List<ClassTypeSignature> superIntSigs = new ArrayList<ClassTypeSignature>(); + List<ClassTypeSignature> 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<FormalTypeParameter> formalTypeParametersList = new ArrayList<FormalTypeParameter>(); + List<FormalTypeParameter> formalTypeParametersList = new ArrayList<>(); do { formalTypeParametersList.add(parseFormalTypeParameter()); } while (!maybeEat(">")); @@ -84,7 +84,7 @@ public class GenericSignatureParser { } // Parameters eat("("); - List<TypeSignature> paramList = new ArrayList<TypeSignature>(); + List<TypeSignature> 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<FieldTypeSignature> throwsList = new ArrayList<FieldTypeSignature>(); + List<FieldTypeSignature> 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<FieldTypeSignature> optionalBounds = new ArrayList<FieldTypeSignature>(); + List<FieldTypeSignature> 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<SimpleClassTypeSignature> nestedTypeList = new ArrayList<SimpleClassTypeSignature>(); + List<SimpleClassTypeSignature> nestedTypeList = new ArrayList<>(); while (maybeEat(".")) { ret.append("."); SimpleClassTypeSignature sig = parseSimpleClassTypeSignature(); @@ -270,7 +270,7 @@ public class GenericSignatureParser { private TypeArgument[] maybeParseTypeArguments() { if (maybeEat("<")) { - List<TypeArgument> typeArgs = new ArrayList<TypeArgument>(); + List<TypeArgument> 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<String> tokens = new ArrayList<String>(); + List<String> 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<Integer> getFirstNumbers(String vm) { - List<Integer> result = new ArrayList<Integer>(); + List<Integer> 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<String> result = new ArrayList<String>(st.countTokens()); + ArrayList<String> 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<String> result = new ArrayList<String>(); + ArrayList<String> 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<String> strings = new ArrayList<String>(); + List<String> 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<Object>(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<String> lines = new LinkedList<String>(); + final LinkedList<String> 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<T> list = new ArrayList<T>(); + ArrayList<T> 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<String> cmd = new ArrayList<String>(); + ArrayList<String> 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<String> cmd = new ArrayList<String>(); + ArrayList<String> 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 extends PartialComparable> { T object; - List<SortObject<T>> smallerObjects = new LinkedList<SortObject<T>>(); - List<SortObject<T>> biggerObjects = new LinkedList<SortObject<T>>(); + List<SortObject<T>> smallerObjects = new LinkedList<>(); + List<SortObject<T>> biggerObjects = new LinkedList<>(); public SortObject(T o) { object = o; @@ -87,7 +87,7 @@ public class PartialOrder { } private static <T extends PartialComparable> void addNewPartialComparable(List<SortObject<T>> graph, T o) { - SortObject<T> so = new SortObject<T>(o); + SortObject<T> so = new SortObject<>(o); for (SortObject<T> 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<SortObject<T>> sortList = new LinkedList<SortObject<T>>(); + List<SortObject<T>> sortList = new LinkedList<>(); for (T object : objects) { addNewPartialComparable(sortList, object); } @@ -193,7 +193,7 @@ public class PartialOrder { } public static void main(String[] args) { - List<Token> l = new ArrayList<Token>(); + List<Token> 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<File> dirs = new ArrayList<File>(); - ArrayList<File> libs = new ArrayList<File>(); - ArrayList<URL> urls = new ArrayList<URL>(); + ArrayList<File> dirs = new ArrayList<>(); + ArrayList<File> libs = new ArrayList<>(); + ArrayList<URL> 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<K,V> extends AbstractMap<K,V> { private ReferenceQueue<? super V> rq = new ReferenceQueue(); public SoftHashMap() { - this.map = new HashMap<K,SpecialValue>(); + this.map = new HashMap<>(); } class SpecialValue extends SoftReference<V> { @@ -65,7 +65,7 @@ public class SoftHashMap<K,V> extends AbstractMap<K,V> { @Override public java.util.Set<Map.Entry<K,V>> entrySet() { if (map.isEmpty()) { return Collections.<K,V>emptyMap().entrySet(); } - Map<K,V> currentContents = new HashMap<K,V>(); + Map<K,V> currentContents = new HashMap<>(); for (Map.Entry<K,SpecialValue> 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<File> dcopy = new ArrayList<File>(); + ArrayList<File> 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<String> result = new ArrayList<String>(); + ArrayList<String> 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<File>(); + 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<String> sourceList = new ArrayList<String>(); + List<String> sourceList = new ArrayList<>(); sourceList.add(file.getPath()); - final ArrayList<String> errors = new ArrayList<String>(); + final ArrayList<String> 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<AjAttribute> ajAttributes = new ArrayList<AjAttribute>(); + List<AjAttribute> 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<TypePattern> parents = new ArrayList<TypePattern>(1); + List<TypePattern> 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<TypePattern> newParents = new ArrayList<TypePattern>(1); - List<ResolvedType> newInterfaceTypes = new ArrayList<ResolvedType>(1); + List<TypePattern> newParents = new ArrayList<>(1); + List<ResolvedType> 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<FormalBinding> bindings = new ArrayList<FormalBinding>(); + List<FormalBinding> 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<MethodArgument> arguments = new ArrayList<MethodArgument>(); + final List<MethodArgument> 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<String> args = new ArrayList<String>(); + List<String> 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<String> ignores = new ArrayList<String>(); + List<String> 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<String, ResolvedMember>(0); - inlineAccessorMethodGens = new HashSet<LazyMethodGen>(); + 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<AjAttribute> methodAttributes = new ArrayList<AjAttribute>(); + List<AjAttribute> 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<AjAttribute> methodAttributes = new ArrayList<AjAttribute>(); + List<AjAttribute> 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<AjAttribute> methodAttributes = new ArrayList<AjAttribute>(); + List<AjAttribute> 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<AjAttribute> methodAttributes = new ArrayList<AjAttribute>(); + List<AjAttribute> 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<ResolvedType> ret = new ArrayList<ResolvedType>(); + Collection<ResolvedType> 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<String> targets = new HashSet<String>(); + Set<String> 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<LazyMethodGen> addedLazyMethodGens = new ArrayList<LazyMethodGen>(); - private final Set<ResolvedMember> addedDispatchTargets = new HashSet<ResolvedMember>(); + private final List<LazyMethodGen> addedLazyMethodGens = new ArrayList<>(); + private final Set<ResolvedMember> addedDispatchTargets = new HashSet<>(); private boolean inReweavableMode = false; private List<IfaceInitList> addedSuperInitializersAsList = null; - private final Map<ResolvedType, IfaceInitList> addedSuperInitializers = new HashMap<ResolvedType, IfaceInitList>(); - private final List<ConcreteTypeMunger> addedThisInitializers = new ArrayList<ConcreteTypeMunger>(); - private final List<ConcreteTypeMunger> addedClassInitializers = new ArrayList<ConcreteTypeMunger>(); + private final Map<ResolvedType, IfaceInitList> addedSuperInitializers = new HashMap<>(); + private final List<ConcreteTypeMunger> addedThisInitializers = new ArrayList<>(); + private final List<ConcreteTypeMunger> addedClassInitializers = new ArrayList<>(); - private final Map<ResolvedMember, ResolvedMember> mapToAnnotationHolder = new HashMap<ResolvedMember, ResolvedMember>(); + private final Map<ResolvedMember, ResolvedMember> 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<BcelShadow> initializationShadows = new ArrayList<BcelShadow>(); + private final List<BcelShadow> initializationShadows = new ArrayList<>(); private BcelClassWeaver(BcelWorld world, LazyClassGen clazz, List<ShadowMunger> shadowMungers, List<ConcreteTypeMunger> typeMungers, List<ConcreteTypeMunger> 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<ShadowMunger>(); + 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<ConcreteTypeMunger> list = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> list = new ArrayList<>(); IfaceInitList(ResolvedType onType) { this.onType = onType; @@ -418,7 +418,7 @@ class BcelClassWeaver implements IClassWeaver { Set<String> aspectsAffectingType = null; if (inReweavableMode || clazz.getType().isAspect()) { - aspectsAffectingType = new HashSet<String>(); + 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<IfaceInitList>(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<LazyMethodGen> methodGens = new ArrayList<LazyMethodGen>(clazz.getMethodGens()); + List<LazyMethodGen> 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<LazyMethodGen> recursiveCtors = new ArrayList<LazyMethodGen>(); + List<LazyMethodGen> 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<String> methodsSet = new HashSet<String>(); + Set<String> 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<ResolvedMember> overriddenMethodsCollector = new ArrayList<ResolvedMember>(); + List<ResolvedMember> 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<Integer> reportedProblems = new ArrayList<Integer>(); + List<Integer> reportedProblems = new ArrayList<>(); List<DeclareAnnotation> allDecams = world.getDeclareAnnotationOnMethods(); if (allDecams.isEmpty()) { @@ -899,7 +899,7 @@ class BcelClassWeaver implements IClassWeaver { return false; // nothing to do } - Set<DeclareAnnotation> unusedDecams = new HashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> 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<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> 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<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> 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<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> worthRetrying = new ArrayList<>(); boolean modificationOccured = false; List<AnnotationGen> annotationsToAdd = null; for (DeclareAnnotation decaM : decaMs) { @@ -998,7 +998,7 @@ class BcelClassWeaver implements IClassWeaver { } if (annotationsToAdd == null) { - annotationsToAdd = new ArrayList<AnnotationGen>(); + 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<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> 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<AnnotationGen>(); + 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<DeclareAnnotation> getMatchingSubset(List<DeclareAnnotation> declareAnnotations, ResolvedType type) { - List<DeclareAnnotation> subset = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> 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<ConcreteTypeMunger> getITDSubset(LazyClassGen clazz, ResolvedTypeMunger.Kind wantedKind) { - List<ConcreteTypeMunger> subset = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> 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<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> 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<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> 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<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> 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<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> 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<Integer> reportedProblems = new ArrayList<Integer>(); + List<Integer> reportedProblems = new ArrayList<>(); List<DeclareAnnotation> allDecafs = world.getDeclareAnnotationOnFields(); if (allDecafs.isEmpty()) { return false; @@ -1389,12 +1389,12 @@ class BcelClassWeaver implements IClassWeaver { List<BcelField> fields = clazz.getFieldGens(); if (fields != null) { - Set<DeclareAnnotation> unusedDecafs = new HashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> unusedDecafs = new HashSet<>(); unusedDecafs.addAll(decafs); for (BcelField field : fields) { if (!field.getName().startsWith(NameMangler.PREFIX)) { // Single first pass - Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> 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<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> 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<String> findAspectsForMungers(LazyMethodGen mg) { - Set<String> aspectsAffectingType = new HashSet<String>(); + Set<String> 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<LazyMethodGen> methodGens, List<LazyMethodGen> recursiveCtors) { boolean inlinedSomething = false; - List<LazyMethodGen> newRecursiveCtors = new ArrayList<LazyMethodGen>(); + List<LazyMethodGen> newRecursiveCtors = new ArrayList<>(); for (LazyMethodGen methodGen : methodGens) { if (!methodGen.getName().equals("<init>")) { continue; @@ -1783,7 +1783,7 @@ class BcelClassWeaver implements IClassWeaver { // search for 'returns' and make them jump to the // aload_<n>,monitorexit InstructionHandle walker = body.getStart(); - List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); + List<InstructionHandle> 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_<n>,monitorexit InstructionHandle walker = body.getStart(); - List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); + List<InstructionHandle> 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_<n>,monitorexit InstructionHandle walker = body.getStart(); - List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); + List<InstructionHandle> 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<InstructionHandle, InstructionHandle> srcToDest = new HashMap<InstructionHandle, InstructionHandle>(); + Map<InstructionHandle, InstructionHandle> 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<Tag, Tag> tagMap = new HashMap<Tag, Tag>(); - Map<BcelShadow, BcelShadow> shadowMap = new HashMap<BcelShadow, BcelShadow>(); + Map<Tag, Tag> tagMap = new HashMap<>(); + Map<BcelShadow, BcelShadow> 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<BcelShadow> shadowAccumulator = new ArrayList<BcelShadow>(); + List<BcelShadow> 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<ResolvedMember> candidates = new ArrayList<ResolvedMember>(); + List<ResolvedMember> 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<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); + Map<GenericSignature.FormalTypeParameter, ReferenceType> 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<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); + Map<GenericSignature.FormalTypeParameter, ReferenceType> 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<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); + Map<GenericSignature.FormalTypeParameter, ReferenceType> 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<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); + Map<GenericSignature.FormalTypeParameter, ReferenceType> 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<String> argsList = new ArrayList<String>(); + List<String> 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<String> names = new ArrayList<String>(); + List<String> 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<ResolvedType> superTypeReference = new WeakReference<ResolvedType>(null); - private WeakReference<ResolvedType[]> superInterfaceReferences = new WeakReference<ResolvedType[]>(null); + private WeakReference<ResolvedType> superTypeReference = new WeakReference<>(null); + private WeakReference<ResolvedType[]> 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<ResolvedType>(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<ResolvedType[]>(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<ResolvedPointcutDefinition> pointcuts = new ArrayList<ResolvedPointcutDefinition>(); - typeMungers = new ArrayList<ConcreteTypeMunger>(); - declares = new ArrayList<Declare>(); + List<ResolvedPointcutDefinition> 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<AnnotationTargetKind> targetKinds = new ArrayList<AnnotationTargetKind>(); + List<AnnotationTargetKind> 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<FormalTypeParameter> allFormals = new ArrayList<FormalTypeParameter>(); + List<FormalTypeParameter> 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<ShadowMunger> src = mungers; if (s.mungers == Collections.EMPTY_LIST) { - s.mungers = new ArrayList<ShadowMunger>(); + s.mungers = new ArrayList<>(); } List<ShadowMunger> 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<BcelAdvice>(); + badAdvice = new ArrayList<>(); } badAdvice.add(advice); } @@ -1431,7 +1431,7 @@ public class BcelShadow extends Shadow { if (thisAnnotationVars != null) { return; } - thisAnnotationVars = new HashMap<ResolvedType, TypeAnnotationAccessVar>(); + thisAnnotationVars = new HashMap<>(); // populate.. } @@ -1445,7 +1445,7 @@ public class BcelShadow extends Shadow { } targetAnnotationVars = thisAnnotationVars; } else { - targetAnnotationVars = new HashMap<ResolvedType, TypeAnnotationAccessVar>(); + 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<ResolvedType, AnnotationAccessVar>(); + 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<ResolvedType, AnnotationAccessVar>(); + 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<ResolvedType, AnnotationAccessVar>(); + 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<InstructionHandle> findReturnInstructions() { - List<InstructionHandle> returns = new ArrayList<InstructionHandle>(); + List<InstructionHandle> 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<String> parameterNames = new ArrayList<String>(); + List<String> parameterNames = new ArrayList<>(); boolean shadowClassIsInterface = shadowClass.isInterface(); LazyMethodGen extractedShadowMethod = extractShadowInstructionsIntoNewMethod(extractedShadowMethodName, shadowClassIsInterface?Modifier.PUBLIC:Modifier.PRIVATE, munger.getSourceLocation(), parameterNames,shadowClassIsInterface); - List<BcelVar> argsToCallLocalAdviceMethodWith = new ArrayList<BcelVar>(); - List<BcelVar> proceedVarList = new ArrayList<BcelVar>(); + List<BcelVar> argsToCallLocalAdviceMethodWith = new ArrayList<>(); + List<BcelVar> 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<String>(),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<String, List<String>> declareParentsMap = thisAspectNode.getDeclareParentsMap(); if (declareParentsMap == null) { - declareParentsMap = new HashMap<String, List<String>>(); + declareParentsMap = new HashMap<>(); thisAspectNode.setDeclareParentsMap(declareParentsMap); } String tname = target.getName(); String pname = newParent.getName(); List<String> newparents = declareParentsMap.get(tname); if (newparents == null) { - newparents = new ArrayList<String>(); + newparents = new ArrayList<>(); declareParentsMap.put(tname, newparents); } newparents.add(pname); @@ -933,7 +933,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger { } else { annotationsOnRealMember = realMember.getAnnotations(); } - Set<ResolvedType> addedAnnotations = new HashSet<ResolvedType>(); + Set<ResolvedType> 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<UnwovenClassFile> addedClasses = new ArrayList<UnwovenClassFile>(); - private transient List<String> deletedTypenames = new ArrayList<String>(); + private transient List<UnwovenClassFile> addedClasses = new ArrayList<>(); + private transient List<String> deletedTypenames = new ArrayList<>(); // These four are setup by prepareForWeave private transient List<ShadowMunger> shadowMungerList = null; @@ -244,7 +244,7 @@ public class BcelWeaver { private List<ResolvedType> addAspectsFromJarFile(File inFile) throws FileNotFoundException, IOException { ZipInputStream inStream = new ZipInputStream(new FileInputStream(inFile)); // ??? buffered - List<ResolvedType> addedAspects = new ArrayList<ResolvedType>(); + List<ResolvedType> addedAspects = new ArrayList<>(); try { while (true) { ZipEntry entry = inStream.getNextEntry(); @@ -286,7 +286,7 @@ public class BcelWeaver { * @throws IOException */ private List<ResolvedType> addAspectsFromDirectory(File directory) throws FileNotFoundException, IOException { - List<ResolvedType> addedAspects = new ArrayList<ResolvedType>(); + List<ResolvedType> 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<UnwovenClassFile> addDirectoryContents(File inFile, File outDir) throws IOException { - List<UnwovenClassFile> addedClassFiles = new ArrayList<UnwovenClassFile>(); + List<UnwovenClassFile> 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<UnwovenClassFile> addJarFile(File inFile, File outDir, boolean canBeDirectory) { // System.err.println("? addJarFile(" + inFile + ", " + outDir + ")"); - List<UnwovenClassFile> addedClassFiles = new ArrayList<UnwovenClassFile>(); + List<UnwovenClassFile> 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<Pointcut, Pointcut> pcMap = new HashMap<Pointcut, Pointcut>(); + Map<Pointcut, Pointcut> 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<String> ambiguousNames = new ArrayList<String>(); + List<String> 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<String> wovenClassNames = new ArrayList<String>(); + Collection<String> wovenClassNames = new ArrayList<>(); IWeaveRequestor requestor = input.getRequestor(); if (world.getModel() != null && world.isMinimalModel()) { - candidatesForRemoval = new HashSet<IProgramElement>(); + 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<String> typesToProcess = new ArrayList<String>(); + List<String> typesToProcess = new ArrayList<>(); for (Iterator<UnwovenClassFile> 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<AdviceLocation> alreadyWarnedLocations = new HashSet<AdviceLocation>(); + Set<AdviceLocation> alreadyWarnedLocations = new HashSet<>(); for (Object o : l) { ShadowMunger element = (ShadowMunger) o; @@ -1353,7 +1353,7 @@ public class BcelWeaver { Set<String> aspectsPreviouslyInWorld = wsi.getAspectsAffectingType(); // keep track of them just to ensure unique missing aspect error // reporting - Set<String> alreadyConfirmedReweavableState = new HashSet<String>(); + Set<String> 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<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>(); + List<DeclareParents> 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<DeclareParents> decpToRepeatNextTime = new ArrayList<DeclareParents>(); + List<DeclareParents> 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<ShadowMunger> result = new ArrayList<ShadowMunger>(); + List<ShadowMunger> 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<String> makeDefaultClasspath(String cp) { - List<String> classPath = new ArrayList<String>(); + List<String> 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<String> getPathEntries(String s) { - List<String> ret = new ArrayList<String>(); + List<String> 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<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>(); + List<DeclareParents> 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<DeclareParents> decpToRepeatNextTime = new ArrayList<DeclareParents>(); + List<DeclareParents> 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<String,String>(); + 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<String> aspectRequiredTypesProcessed = new ArrayList<String>(); + private List<String> aspectRequiredTypesProcessed = new ArrayList<>(); private Map<String, String> aspectRequiredTypes = null; public void addAspectRequires(String aspectClassName, String requiredType) { if (aspectRequiredTypes == null) { - aspectRequiredTypes = new HashMap<String, String>(); + 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<Definition> definitions = new ArrayList<Definition>(); + private List<Definition> definitions = new ArrayList<>(); - private List<String> resolvedIncludedAspects = new ArrayList<String>(); - private Map<String, TypePattern> scopes = new HashMap<String, TypePattern>(); + private List<String> resolvedIncludedAspects = new ArrayList<>(); + private Map<String, TypePattern> 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<String> includedFastMatchPatterns = Collections.emptyList(); @@ -1180,7 +1180,7 @@ public class BcelWorld extends World implements Repository { public void ensureInitialized() { if (!initialized) { try { - resolvedIncludedAspects = new ArrayList<String>(); + resolvedIncludedAspects = new ArrayList<>(); // Process the definitions into something more optimal for (Definition definition : definitions) { List<String> aspectNames = definition.getAspectClassNames(); @@ -1217,8 +1217,8 @@ public class BcelWorld extends World implements Repository { try { List<String> includePatterns = definition.getIncludePatterns(); if (includePatterns.size() > 0) { - includedPatterns = new ArrayList<TypePattern>(); - includedFastMatchPatterns = new ArrayList<String>(); + 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<String> excludePatterns = definition.getExcludePatterns(); if (excludePatterns.size() > 0) { - excludedPatterns = new ArrayList<TypePattern>(); - excludedFastMatchPatterns = new ArrayList<String>(); + 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<TypeDelegateResolver>(); + 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<ZipFile> openArchives = new ArrayList<ZipFile>(); + private List<ZipFile> openArchives = new ArrayList<>(); static { String openzipsString = getSystemPropertyWithoutSecurityException("org.aspectj.weaver.openarchives", @@ -82,7 +82,7 @@ public class ClassPathManager { if (trace.isTraceEnabled()) { trace.enter("<init>", this, new Object[] { classpath==null?"null":classpath.toString(), handler }); } - entries = new ArrayList<Entry>(); + 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<String,Path> fileCache = new SoftHashMap<String, Path>(); + Map<String,Path> fileCache = new SoftHashMap<>(); boolean packageCacheInitialized = false; - Map<String,Path> packageCache = new HashMap<String, Path>(); + Map<String,Path> packageCache = new HashMap<>(); public JImageState(String jrtFsPath, FileSystem fs) { this.jrtFsPath = jrtFsPath; @@ -516,7 +516,7 @@ public class ClassPathManager { public List<ZipEntryClassFile> getAllClassFiles() throws IOException { ensureOpen(); - List<ZipEntryClassFile> ret = new ArrayList<ZipEntryClassFile>(); + List<ZipEntryClassFile> ret = new ArrayList<>(); for (Enumeration<? extends ZipEntry> 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<String, InlinedSourceFileInfo> inlinedFiles = new TreeMap<String, InlinedSourceFileInfo>(); + private final SortedMap<String, InlinedSourceFileInfo> 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<BcelField> fields = new ArrayList<BcelField>(); - private final List<LazyMethodGen> methodGens = new ArrayList<LazyMethodGen>(); - private final List<LazyClassGen> classGens = new ArrayList<LazyClassGen>(); - private final List<AnnotationGen> annotations = new ArrayList<AnnotationGen>(); + private final List<BcelField> fields = new ArrayList<>(); + private final List<LazyMethodGen> methodGens = new ArrayList<>(); + private final List<LazyClassGen> classGens = new ArrayList<>(); + private final List<AnnotationGen> 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<LazyClassGen> getClassGens() { - List<LazyClassGen> ret = new ArrayList<LazyClassGen>(); + List<LazyClassGen> 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<UnwovenClassFile.ChildClass> ret = new ArrayList<UnwovenClassFile.ChildClass>(); + List<UnwovenClassFile.ChildClass> 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<BcelShadow, Field> tjpFields = new HashMap<BcelShadow, Field>(); - Map<CacheKey, Field> annotationCachingFieldCache = new HashMap<CacheKey, Field>(); + private Map<BcelShadow, Field> tjpFields = new HashMap<>(); + Map<CacheKey, Field> 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<InstructionList> lists = new Vector<InstructionList>(); + Vector<InstructionList> lists = new Vector<>(); InstructionList list = initInstructionList(); lists.add(list); - List<Map.Entry<BcelShadow, Field>> entries = new ArrayList<Map.Entry<BcelShadow, Field>>(tjpFields.entrySet()); + List<Map.Entry<BcelShadow, Field>> entries = new ArrayList<>(tjpFields.entrySet()); Collections.sort(entries, new Comparator<Map.Entry<BcelShadow, Field>>() { @Override public int compare(Map.Entry<BcelShadow, Field> a, Map.Entry<BcelShadow, Field> 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<Attribute>(); + 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<AnnotationAJ>(); + 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<ResolvedType>(); + annotationsForRemoval = new ArrayList<>(); } annotationsForRemoval.add(annotationType); } else { @@ -627,7 +627,7 @@ public final class LazyMethodGen implements Traceable { } private class BodyPrinter { - Map<InstructionHandle, String> labelMap = new HashMap<InstructionHandle, String>(); + Map<InstructionHandle, String> labelMap = new HashMap<>(); InstructionList body; PrintStream out; @@ -653,7 +653,7 @@ public final class LazyMethodGen implements Traceable { // label assignment void assignLabels() { - LinkedList<ExceptionRange> exnTable = new LinkedList<ExceptionRange>(); + LinkedList<ExceptionRange> 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<ExceptionRange> exceptionList = new LinkedList<ExceptionRange>(); + LinkedList<ExceptionRange> exceptionList = new LinkedList<>(); - Map<LocalVariableTag, LVPosition> localVariables = new HashMap<LocalVariableTag, LVPosition>(); + Map<LocalVariableTag, LVPosition> 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<LocalVariableTag, LVPosition> localVariables = new HashMap<LocalVariableTag, LVPosition>(); - LinkedList<ExceptionRange> exceptionList = new LinkedList<ExceptionRange>(); - Set<InstructionHandle> forDeletion = new HashSet<InstructionHandle>(); - Set<BranchHandle> branchInstructions = new HashSet<BranchHandle>(); + Map<LocalVariableTag, LVPosition> localVariables = new HashMap<>(); + LinkedList<ExceptionRange> exceptionList = new LinkedList<>(); + Set<InstructionHandle> forDeletion = new HashSet<>(); + Set<BranchHandle> 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<InstructionHandle, Set<Integer>> duplicatedLocalMap = new HashMap<InstructionHandle, Set<Integer>>(); + Map<InstructionHandle, Set<Integer>> 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<Integer> slots = duplicatedLocalMap.get(start); if (slots == null) { - slots = new HashSet<Integer>(); + 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<InstructionHandle, InstructionHandle> copyAllInstructionsExceptRangeInstructionsInto(InstructionList intoList) { - Map<InstructionHandle, InstructionHandle> map = new HashMap<InstructionHandle, InstructionHandle>(); + Map<InstructionHandle, InstructionHandle> 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<AjAttribute> readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w, AjAttribute.WeaverVersionInfo version, ConstantPoolReader dataDecompressor) { - List<AjAttribute> attributes = new ArrayList<AjAttribute>(); + List<AjAttribute> attributes = new ArrayList<>(); // first pass, look for version - List<Unknown> forSecondPass = new ArrayList<Unknown>(); + List<Unknown> 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<String, String> validBoxing = new Hashtable<String, String>(); + private static Hashtable<String, String> 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<Lint.Kind> suppressedWarnings = new ArrayList<Lint.Kind>(); + List<Lint.Kind> 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<String>(); - includePatterns = new ArrayList<String>(); - excludePatterns = new ArrayList<String>(); - aspectClassNames = new ArrayList<String>(); - aspectExcludePatterns = new ArrayList<String>(); - aspectIncludePatterns = new ArrayList<String>(); - concreteAspects = new ArrayList<Definition.ConcreteAspect>(); - scopedAspects = new HashMap<String, String>(); - requiredTypesForAspects = new HashMap<String, String>(); + 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<Definition.Pointcut>(); - this.declareAnnotations = new ArrayList<Definition.DeclareAnnotation>(); - this.pointcutsAndAdvice = new ArrayList<Definition.PointcutAndAdvice>(); - this.deows = new ArrayList<Definition.DeclareErrorOrWarning>(); + 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<String, Definition> parsedFiles = new Hashtable<String, Definition>(); + private static Hashtable<String, Definition> 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<String, char[]> entities = new HashMap<String, char[]>(); + private static Map<String, char[]> 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<String, Object>(); + 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<String, Object>(); + 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<IProgramElement>()); + 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<IProgramElement>()); + 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<IProgramElement>()); + 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<IProgramElement>()); + 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.<char[]>emptyList(), Collections.<String>emptyList()); } else { - List<char[]> paramSigs = new ArrayList<char[]>(); + List<char[]> 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<String> parents = new ArrayList<String>(); + List<String> 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<Type, TypeVariableReferenceType> typeVariablesInProgress = new HashMap<Type, TypeVariableReferenceType>(); + private Map<Type, TypeVariableReferenceType> 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<String, IUnwovenClassFile> generatedClasses = new HashMap<String, IUnwovenClassFile>(); + protected Map<String, IUnwovenClassFile> 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<String> getFullClassPath(ClassLoader loader) { - List<String> list = new LinkedList<String>(); + List<String> 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<String> getFullAspectPath(ClassLoader loader) { - List<String> list = new LinkedList<String>(); + List<String> 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<String> makeClasspath(String cp) { - List<String> ret = new ArrayList<String>(); + List<String> 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<IMessage>(); + savedMessages = new ArrayList<>(); savedMessages.addAll(super.getUnmodifiableListView()); clearMessages(); for (IMessage message : savedMessages) { @@ -794,7 +794,7 @@ public class WeavingAdaptor implements IMessageContext { @Override public List<IMessage> getUnmodifiableListView() { // System.err.println("? WeavingAdaptorMessageHolder.getUnmodifiableListView() savedMessages=" + savedMessages); - List<IMessage> allMessages = new ArrayList<IMessage>(); + List<IMessage> 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<IMessage.Kind> ignoring = new HashSet<IMessage.Kind>(); + private final Set<IMessage.Kind> 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<UnwovenClassFile> unwovenClasses = new ArrayList<UnwovenClassFile>(); + private final List<UnwovenClassFile> 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<String> matches=new LinkedList<String>(); + Collection<String> 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<String, IndexEntry> getIndex (); protected Map<String, IndexEntry> readIndex (File cacheDir, File cacheFile) { - Map<String, IndexEntry> indexMap=new TreeMap<String, IndexEntry>(); + Map<String, IndexEntry> 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 <U>concrete</U> classes */ public abstract class AsynchronousFileCacheBacking extends AbstractIndexedFileCacheBacking { - private static final BlockingQueue<AsyncCommand> commandsQ=new LinkedBlockingQueue<AsyncCommand>(); + private static final BlockingQueue<AsyncCommand> 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<IndexEntry>(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<String> aspects) { String name = cl != null ? cl.getClass().getSimpleName() : "unknown"; - List<String> hashableStrings = new LinkedList<String>(); + List<String> 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<String, byte[]> readClassBytes (Map<String,IndexEntry> indexMap, File[] files) { - Map<String, byte[]> result=new TreeMap<String, byte[]>(); + Map<String, byte[]> 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<WeavedClassCache> cacheRegistry = new LinkedList<WeavedClassCache>(); + private static final List<WeavedClassCache> cacheRegistry = new LinkedList<>(); protected WeavedClassCache(GeneratedClassHandler existingClassHandler, IMessageHandler messageHandler, @@ -259,7 +259,7 @@ public class WeavedClassCache { */ public static List<WeavedClassCache> getCaches() { synchronized (cacheRegistry) { - return new LinkedList<WeavedClassCache>(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<String,byte[]>(); + entriesMap = new TreeMap<>(); okEntries = false; } @@ -196,7 +196,7 @@ public class ZippedFileCacheBacking extends AsynchronousFileCacheBacking { } if (toDelete == null) { - toDelete = new TreeSet<String>(); + toDelete = new TreeSet<>(); } toDelete.add(key); } @@ -259,7 +259,7 @@ public class ZippedFileCacheBacking extends AsynchronousFileCacheBacking { return Collections.emptyMap(); } - Map<String,byte[]> result=new TreeMap<String,byte[]>(); + Map<String,byte[]> 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<String, List<String>> expectedResults = new HashMap<>(); static { - List<String> sigs = new ArrayList<String>(); + List<String> 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<String>(); + 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<String>(); + 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<String>(); + 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<String>(); + 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<String> listOfString = new ArrayList<String>(); + List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); @@ -192,7 +192,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable02() { List list = new ArrayList(); ArrayList arraylist = null; - List<String> listOfString = new ArrayList<String>(); + List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); ArrayList<?> arrayListOfSomething = null; List<Number> listOfNumber = null; @@ -200,7 +200,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); - List<Integer> listOfInteger = new ArrayList<Integer>(); + List<Integer> listOfInteger = new ArrayList<>(); ArrayList<String> arrayListOfString; ArrayList<Integer> arraylistOfInteger; // interfaces too List<? extends A,B> @@ -275,7 +275,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable03_method_m2() { List list = new ArrayList(); ArrayList arraylist = null; - List<String> listOfString = new ArrayList<String>(); + List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); ArrayList<?> arrayListOfSomething = null; List<Number> listOfNumber = null; @@ -284,7 +284,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); - List<Integer> listOfInteger = new ArrayList<Integer>(); + List<Integer> listOfInteger = new ArrayList<>(); ArrayList<String> arrayListOfString; ArrayList<Integer> arraylistOfInteger; // interfaces too List<? extends A,B> @@ -362,7 +362,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable04_method_m3() { List list = new ArrayList(); ArrayList arraylist = null; - List<String> listOfString = new ArrayList<String>(); + List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); ArrayList<?> arrayListOfSomething = null; List<Number> listOfNumber = null; @@ -371,7 +371,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); - List<Integer> listOfInteger = new ArrayList<Integer>(); + List<Integer> listOfInteger = new ArrayList<>(); ArrayList arrayList = null; ArrayList<String> arrayListOfString; ArrayList<Integer> arraylistOfInteger; @@ -478,7 +478,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable03_method_m4() { List list = new ArrayList(); ArrayList arraylist = null; - List<String> listOfString = new ArrayList<String>(); + List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); ArrayList<?> arrayListOfSomething = null; List<Number> listOfNumber = null; @@ -486,7 +486,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); - List<Integer> listOfInteger = new ArrayList<Integer>(); + List<Integer> listOfInteger = new ArrayList<>(); ArrayList<String> arrayListOfString; ArrayList<Integer> arraylistOfInteger; // interfaces too List<? extends A,B> @@ -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<ConcreteTypeMunger> list = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> 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<String> fieldList = new ArrayList<String>(); + List<String> 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<ShadowMunger> getShadowMungers() { - List<ShadowMunger> ret = new ArrayList<ShadowMunger>(); + List<ShadowMunger> 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<ShadowMunger> l = new ArrayList<ShadowMunger>(1); + List<ShadowMunger> l = new ArrayList<>(1); l.add(planner); weaveTest(name, outName, l); } @@ -215,7 +215,7 @@ public abstract class WeaveTestCase extends TestCase { } public List<ShadowMunger> makeAdviceAll(String kind, boolean matchOnlyPrintln) { - List<ShadowMunger> ret = new ArrayList<ShadowMunger>(); + List<ShadowMunger> 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<IMessage> messages = new ArrayList<IMessage>(); + public List<IMessage> 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<PointcutPrimitive> DEFAULT_SUPPORTED_PRIMITIVES = new HashSet<PointcutPrimitive>(); + private static final Set<PointcutPrimitive> 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<String> expected = new HashSet<String>(); + Set<String> 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<String>(); + 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<String> parameterAnnotations = new ArrayList<String>(); - private List<String> parameterTypeAnnotations = new ArrayList<String>(); + private List<String> parameterAnnotations = new ArrayList<>(); + private List<String> parameterTypeAnnotations = new ArrayList<>(); public String getStringRepresentation() { return stringRep.toString(); } public List<String> 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<PointcutPrimitive> q = new HashSet<PointcutPrimitive>(); + Set<PointcutPrimitive> 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<String, File> files=new TreeMap<String, File>(); + Map<String, File> 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<String, File> badFiles = new TreeMap<String, File>(); + Map<String, File> 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<String, File> dataFiles = new TreeMap<String, File>(); + Map<String, File> 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<String, CachedClassEntry> cache = new HashMap<String, CachedClassEntry>(); + HashMap<String, CachedClassEntry> cache = new HashMap<>(); public String[] getKeys(String regex) { Set<String> keys = cache.keySet(); - List<String> matches = new LinkedList<String>(); + List<String> 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<String> classesISaw = new LinkedList<String>(); + public List<String> 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<String,byte[]> entriesMap=new TreeMap<String,byte[]>(); + Map<String,byte[]> 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<String,byte[]> entriesMap=new TreeMap<String,byte[]>(); + Map<String,byte[]> 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<String,byte[]> entriesMap=new TreeMap<String,byte[]>(); + Map<String,byte[]> entriesMap= new TreeMap<>(); for (IndexEntry ie : entries) { if (ie.ignored) { continue; |