diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-13 01:01:58 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-13 01:01:58 +0200 |
commit | e1bff9a5703baf17ec650b173bdfe776bf87125f (patch) | |
tree | 8b4443759c231a6c46cb70c755fe554a4b621e11 /tests | |
parent | b6eee2e1052116aa22ebbd3c2baf05c2b709bee5 (diff) | |
download | aspectj-e1bff9a5703baf17ec650b173bdfe776bf87125f.tar.gz aspectj-e1bff9a5703baf17ec650b173bdfe776bf87125f.zip |
Use the diamond operator where possible
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'tests')
9 files changed, 42 insertions, 42 deletions
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) { |