From 639f5030e0391e831138f9786cf831c3374449e7 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Sat, 15 Aug 2020 17:01:46 +0200 Subject: [PATCH] Weaken Collection declarations Reports on declarations of Collection variables made by using the collection class as the type, rather than an appropriate interface. Signed-off-by: Lars Grefer --- .../tools/ajbrowser/ui/EditorManager.java | 3 +- .../core/internal/AjdeCoreBuildManager.java | 2 +- .../aspectj/ajde/ui/StructureViewManager.java | 2 +- .../aspectj/ajde/ui/swing/PointcutWizard.java | 3 +- .../aspectj/tools/ajdoc/JavadocRunner.java | 2 +- .../java/org/aspectj/tools/ajdoc/Main.java | 2 +- .../tools/ajdoc/StubFileGenerator.java | 3 +- .../main/java/org/aspectj/asm/AsmManager.java | 2 +- .../main/java/org/aspectj/asm/IHierarchy.java | 6 +++- .../asm/internal/AspectJElementHierarchy.java | 2 +- .../bcel/generic/FieldGenOrMethodGen.java | 4 +-- .../apache/bcel/generic/InstructionList.java | 9 ++--- .../apache/bcel/generic/MethodGen.java | 14 +++----- .../aspectj/apache/bcel/util/ClassPath.java | 10 ++---- .../classfile/tests/AnnotationGenTest.java | 4 +-- .../tests/GenericSignatureParsingTest.java | 3 +- .../org/aspectj/bridge/MessageHandler.java | 2 +- .../java/org/aspectj/bridge/MessageUtil.java | 2 +- .../context/CompilationAndWeavingContext.java | 2 +- .../tools/ant/taskdefs/Checklics.java | 2 +- .../aspectj/internal/tools/build/Builder.java | 10 +++--- .../aspectj/internal/tools/build/Module.java | 2 +- .../aspectj/internal/tools/build/Result.java | 2 +- .../internal/tools/build/SampleGatherer.java | 2 +- .../aspectj/internal/tools/build/Util.java | 2 +- .../org/aspectj/build/BuildModuleTests.java | 2 +- .../internal/build/BuildModuleTest.java | 9 ++--- .../aspectj/internal/build/ModulesTest.java | 4 +-- .../org/aspectj/ajdt/ajc/BuildArgParser.java | 2 +- .../ajdt/internal/compiler/ast/AstUtil.java | 2 +- .../internal/core/builder/AjBuildConfig.java | 4 +-- .../aspectj/ajdt/ajc/AjdtCommandTestCase.java | 3 +- .../compiler/batch/IncrementalCase.java | 8 ++--- .../org/aspectj/tools/ajc/ASTVisitorTest.java | 2 +- .../org/aspectj/tools/ajc/AjcTestCase.java | 2 +- .../java/org/aspectj/tools/ajc/MainTest.java | 3 +- .../aspectj/weaver/CrosscuttingMembers.java | 4 +-- .../java/org/aspectj/weaver/ResolvedType.java | 4 +-- .../aspectj/tools/ant/taskdefs/AjcTask.java | 2 +- .../taskdefs/Ajc11CompilerAdapterTest.java | 3 +- .../main/java/org/aspectj/testing/Tester.java | 2 +- .../java/org/aspectj/testing/TesterTest.java | 4 +-- .../org/aspectj/testing/drivers/Harness.java | 10 +++--- .../harness/bridge/AbstractRunSpec.java | 6 ++-- .../testing/harness/bridge/AjcSpecTest.java | 2 +- .../testing/harness/bridge/AjcTest.java | 4 +-- .../testing/harness/bridge/CompilerRun.java | 4 +-- .../testing/harness/bridge/DirChanges.java | 8 ++--- .../harness/bridge/FlatSuiteReader.java | 6 ++-- .../testing/harness/bridge/Globals.java | 2 +- .../harness/bridge/IncCompilerRun.java | 2 +- .../testing/harness/bridge/Validator.java | 11 ++---- .../org/aspectj/testing/run/RunListeners.java | 3 +- .../taskdefs/AjcTaskCompileCommandTest.java | 5 +-- .../java/org/aspectj/testing/util/Diffs.java | 8 ++--- .../org/aspectj/testing/util/FileUtil.java | 11 ++---- .../org/aspectj/testing/util/LangUtil.java | 6 ++-- .../aspectj/testing/util/LangUtilTest.java | 18 +++++----- .../org/aspectj/testing/util/LinkCheck.java | 10 +++--- .../aspectj/testing/util/MessageUtilTest.java | 6 ++-- .../aspectj/testing/util/TestClassLoader.java | 2 +- .../org/aspectj/testing/util/TestDiffs.java | 6 ++-- .../aspectj/testing/util/TestDiffsTest.java | 3 +- .../aspectj/testing/util/options/Option.java | 2 +- .../aspectj/testing/util/options/Options.java | 3 +- .../testing/xml/AjcSpecXmlReaderTest.java | 7 ++-- .../testing/xml/MessageListXmlReaderTest.java | 3 +- .../org/aspectj/testing/xml/SoftMessage.java | 2 +- .../tools/AnnotationProcessingTests.java | 7 ++-- .../MultiProjTestCompilerConfiguration.java | 2 +- .../tools/MultiProjectIncrementalTests.java | 8 ++--- .../main/java/org/aspectj/util/FileUtil.java | 2 +- .../main/java/org/aspectj/util/LangUtil.java | 6 ++-- .../org/aspectj/util/UtilClassLoader.java | 2 +- .../java/org/aspectj/util/FileUtilTest.java | 10 +++--- .../org/aspectj/weaver/bcel/BcelWeaver.java | 2 +- .../aspectj/weaver/bcel/ClassPathManager.java | 4 +-- .../aspectj/weaver/bcel/LazyMethodGen.java | 4 +-- .../loadtime/definition/SimpleAOPParser.java | 2 +- .../aspectj/weaver/ReferenceTypeTestCase.java | 36 +++++++++---------- 80 files changed, 193 insertions(+), 199 deletions(-) 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 b737cf07e..249992dd7 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 @@ -17,6 +17,7 @@ import java.awt.BorderLayout; import java.awt.event.KeyEvent; import java.io.IOException; import java.util.ArrayList; +import java.util.List; import java.util.Vector; import javax.swing.Box; @@ -43,7 +44,7 @@ public class EditorManager { private EditorAdapter editor = null; private BasicEditor basicEditor = null; - private ArrayList editorListeners = new ArrayList<>(); + private List editorListeners = new ArrayList<>(); private Vector editors = new Vector<>(); private JPanel editor_panel = null; private Box editors_box = Box.createVerticalBox(); diff --git a/ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java b/ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java index 7aec20809..e9f3a1b86 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 @@ -278,7 +278,7 @@ public class AjdeCoreBuildManager { } } if (0 < toAdd.size()) { - ArrayList both = new ArrayList<>(configClasspath.size() + toAdd.size()); + List both = new ArrayList<>(configClasspath.size() + toAdd.size()); both.addAll(configClasspath); both.addAll(toAdd); config.setClasspath(both); diff --git a/ajde/src/main/java/org/aspectj/ajde/ui/StructureViewManager.java b/ajde/src/main/java/org/aspectj/ajde/ui/StructureViewManager.java index 9b23439e4..8f60ff824 100644 --- a/ajde/src/main/java/org/aspectj/ajde/ui/StructureViewManager.java +++ b/ajde/src/main/java/org/aspectj/ajde/ui/StructureViewManager.java @@ -36,7 +36,7 @@ public class StructureViewManager { // private String buildConfigFilePath = null; private final NavigationHistoryModel historyModel = new NavigationHistoryModel(); - private final ArrayList structureViews = new ArrayList(); + private final List structureViews = new ArrayList(); private FileStructureView defaultFileView = null; private static final StructureViewProperties DEFAULT_VIEW_PROPERTIES; diff --git a/ajde/src/main/java/org/aspectj/ajde/ui/swing/PointcutWizard.java b/ajde/src/main/java/org/aspectj/ajde/ui/swing/PointcutWizard.java index fb461d132..f80ff76e6 100644 --- a/ajde/src/main/java/org/aspectj/ajde/ui/swing/PointcutWizard.java +++ b/ajde/src/main/java/org/aspectj/ajde/ui/swing/PointcutWizard.java @@ -17,6 +17,7 @@ package org.aspectj.ajde.ui.swing; import java.awt.BorderLayout; //import java.awt.event.ActionEvent; import java.util.ArrayList; +import java.util.List; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -55,7 +56,7 @@ class PointcutWizard extends JFrame { public PointcutWizard(java.util.List signatures) { // this.signatures = signatures; - ArrayList views = new ArrayList(); + List views = new ArrayList(); views.add(StructureViewProperties.Hierarchy.INHERITANCE); // typeTreeView = new BrowserViewPanel(AjdeUIManager.getDefault().getIconRegistry(), views, StructureViewProperties.Hierarchy.INHERITANCE); diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java index adf22bf12..e1bbd9ad4 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java @@ -28,7 +28,7 @@ import javax.tools.ToolProvider; */ class JavadocRunner { - public static void callJavadocViaToolProvider(Vector options, List files) { + public static void callJavadocViaToolProvider(Iterable options, List files) { DocumentationTool doctool = ToolProvider.getSystemDocumentationTool(); StandardJavaFileManager fm = doctool.getStandardFileManager(null, null, null); Iterable jfos = fm.getJavaFileObjects(files.toArray(new String[0])); 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 57b7bce6e..e65c8901f 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java @@ -157,7 +157,7 @@ public class Main implements Config { * package-summary properly. */ private static void packageHTML(AsmManager model, File[] inputFiles) throws IOException { - ArrayList dirList = new ArrayList<>(); + List dirList = new ArrayList<>(); for (File inputFile : inputFiles) { String packageName = StructureUtil.getPackageDeclarationFromFile(model, inputFile); // Only copy the package.html file once. diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StubFileGenerator.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StubFileGenerator.java index 4b9301ce8..c68123aba 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StubFileGenerator.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StubFileGenerator.java @@ -22,6 +22,7 @@ import java.io.PrintWriter; import java.util.Hashtable; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.aspectj.asm.AsmManager; import org.aspectj.asm.IProgramElement; @@ -32,7 +33,7 @@ import org.aspectj.util.FileUtil; */ class StubFileGenerator { - static Hashtable declIDTable = null; + static Map declIDTable = null; static void doFiles(AsmManager model, Hashtable table, File[] inputFiles, File[] signatureFiles) throws DocException { declIDTable = table; diff --git a/asm/src/main/java/org/aspectj/asm/AsmManager.java b/asm/src/main/java/org/aspectj/asm/AsmManager.java index dc766eb7f..5fcaf3cf6 100644 --- a/asm/src/main/java/org/aspectj/asm/AsmManager.java +++ b/asm/src/main/java/org/aspectj/asm/AsmManager.java @@ -155,7 +155,7 @@ public class AsmManager implements IStructureModel { return null; } else { IProgramElement fileNode = node; - ArrayList peNodes = new ArrayList<>(); + List peNodes = new ArrayList<>(); getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType); for (IProgramElement peNode : peNodes) { List entries = new ArrayList<>(); diff --git a/asm/src/main/java/org/aspectj/asm/IHierarchy.java b/asm/src/main/java/org/aspectj/asm/IHierarchy.java index 6674cdaea..80ed2b551 100644 --- a/asm/src/main/java/org/aspectj/asm/IHierarchy.java +++ b/asm/src/main/java/org/aspectj/asm/IHierarchy.java @@ -39,7 +39,11 @@ public interface IHierarchy extends Serializable { public boolean removeFromFileMap(String canonicalFilePath); - public void setFileMap(HashMap fileMap); + public void setFileMap(Map fileMap); + + public default void setFileMap(HashMap fileMap) { + setFileMap((Map) fileMap); + } public Object findInFileMap(Object key); 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 869affd91..c524c554a 100644 --- a/asm/src/main/java/org/aspectj/asm/internal/AspectJElementHierarchy.java +++ b/asm/src/main/java/org/aspectj/asm/internal/AspectJElementHierarchy.java @@ -96,7 +96,7 @@ public class AspectJElementHierarchy implements IHierarchy { return fileMap.remove(canonicalFilePath) != null; } - public void setFileMap(HashMap fileMap) { + public void setFileMap(Map fileMap) { this.fileMap = fileMap; } 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 c8e1fe2fb..5b4256685 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java @@ -76,8 +76,8 @@ public abstract class FieldGenOrMethodGen extends Modifiers { protected String name; protected Type type; protected ConstantPool cp; - private ArrayList attributeList = new ArrayList<>(); - protected ArrayList annotationList = new ArrayList<>(); + private List attributeList = new ArrayList<>(); + protected List annotationList = new ArrayList<>(); protected FieldGenOrMethodGen() { } 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 156adf0ad..7938218bc 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 @@ -58,10 +58,7 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Set; +import java.util.*; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.Constant; @@ -690,7 +687,7 @@ public class InstructionList implements Serializable { return; } - ArrayList target_vec = new ArrayList<>(); + List target_vec = new ArrayList<>(); for (InstructionHandle ih = first; ih != null; ih = ih.next) { ih.getInstruction().dispose(); // e.g. BranchInstructions release their targets @@ -1003,7 +1000,7 @@ public class InstructionList implements Serializable { */ public Instruction[] getInstructions() { ByteSequence bytes = new ByteSequence(getByteCode()); - ArrayList instructions = new ArrayList<>(); + List instructions = new ArrayList<>(); try { while (bytes.available() > 0) { 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 cf8c06834..453fe7c1f 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 @@ -54,11 +54,7 @@ package org.aspectj.apache.bcel.generic; * . */ -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Stack; +import java.util.*; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.Attribute; @@ -103,11 +99,11 @@ public class MethodGen extends FieldGenOrMethodGen { private int highestLineNumber = 0; - private ArrayList localVariablesList = new ArrayList<>(); - private ArrayList lineNumbersList = new ArrayList<>(); + private List localVariablesList = new ArrayList<>(); + private List lineNumbersList = new ArrayList<>(); private ArrayList exceptionsList = new ArrayList<>(); private ArrayList exceptionsThrown = new ArrayList<>(); - private ArrayList codeAttributesList = new ArrayList<>(); + private List codeAttributesList = new ArrayList<>(); private List[] param_annotations; // Array of lists containing AnnotationGen objects private boolean hasParameterAnnotations = false; private boolean haveUnpackedParameterAnnotations = false; @@ -934,7 +930,7 @@ public class MethodGen extends FieldGenOrMethodGen { static final class BranchStack { Stack branchTargets = new Stack<>(); - Hashtable visitedTargets = new Hashtable<>(); + Map visitedTargets = new Hashtable<>(); public void push(InstructionHandle target, int stackDepth) { if (visited(target)) { 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 179800540..678abb1dc 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 @@ -69,11 +69,7 @@ import java.nio.file.Path; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.attribute.BasicFileAttributes; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.StringTokenizer; +import java.util.*; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -106,7 +102,7 @@ public class ClassPath implements Serializable { public ClassPath(String class_path) { this.class_path = class_path; - ArrayList vec = new ArrayList<>(); + List vec = new ArrayList<>(); for (StringTokenizer tok = new StringTokenizer(class_path, System.getProperty("path.separator")); tok .hasMoreTokens();) { @@ -167,7 +163,7 @@ public class ClassPath implements Serializable { return false; } - private static final void getPathComponents(String path, ArrayList list) { + private static final void getPathComponents(String path, List list) { if (path != null) { StringTokenizer tok = new StringTokenizer(path, File.pathSeparator); 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 d684144eb..84f9d9532 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 @@ -97,7 +97,7 @@ public class AnnotationGenTest extends BcelTestCase { // Build a RV annotation of type 'SimpleAnnotation' with 'id=4' as the only value :) AnnotationGen a = new AnnotationGen(t, elements, true, cp); - Vector v = new Vector<>(); + List v = new Vector<>(); v.add(a); Collection attributes = Utility.getAnnotationAttributes(cp, v); boolean foundRV = false; @@ -113,7 +113,7 @@ public class AnnotationGenTest extends BcelTestCase { // Build a RIV annotation of type 'SimpleAnnotation' with 'id=4' as the only value :) AnnotationGen a2 = new AnnotationGen(t, elements, false, cp); - Vector v2 = new Vector<>(); + List v2 = new Vector<>(); v2.add(a2); Collection attributes2 = Utility.getAnnotationAttributes(cp, v2); boolean foundRIV = false; diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java index 255dc77ff..c97e12678 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 @@ -12,6 +12,7 @@ package org.aspectj.apache.bcel.classfile.tests; import java.util.ArrayList; +import java.util.List; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.Attribute; @@ -415,7 +416,7 @@ public class GenericSignatureParsingTest extends BcelTestCase { * @return Array of argument types */ public static final String[] methodSignatureArgumentTypes(String signature,boolean chopit) throws ClassFormatException { - ArrayList vec = new ArrayList<>(); + List vec = new ArrayList<>(); int index; String[] types; diff --git a/bridge/src/main/java/org/aspectj/bridge/MessageHandler.java b/bridge/src/main/java/org/aspectj/bridge/MessageHandler.java index 23c2ef3b2..95bcf029d 100644 --- a/bridge/src/main/java/org/aspectj/bridge/MessageHandler.java +++ b/bridge/src/main/java/org/aspectj/bridge/MessageHandler.java @@ -31,7 +31,7 @@ public class MessageHandler implements IMessageHolder { /** messages accumulated */ protected final ArrayList messages; /** kinds of messages to be ignored */ - protected final ArrayList ignoring; + protected final List ignoring; /** result of handleMessage(..) for messages not accumulated (ignored) */ protected boolean handleMessageResult; /** listener which can halt processing by returning true */ diff --git a/bridge/src/main/java/org/aspectj/bridge/MessageUtil.java b/bridge/src/main/java/org/aspectj/bridge/MessageUtil.java index d55ac3c3b..0ebe113e0 100644 --- a/bridge/src/main/java/org/aspectj/bridge/MessageUtil.java +++ b/bridge/src/main/java/org/aspectj/bridge/MessageUtil.java @@ -409,7 +409,7 @@ public class MessageUtil { if (null == kind) { return messages; } - ArrayList result = new ArrayList<>(); + List result = new ArrayList<>(); for (IMessage message : messages) { if (kind == message.getKind()) { result.add(message); 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 2ae13a279..e1ea09a99 100644 --- a/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java +++ b/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java @@ -130,7 +130,7 @@ public class CompilationAndWeavingContext { * Returns a string description of what the compiler/weaver is currently doing */ public static String getCurrentContext() { - Stack contextStack = getContextStack(); + Iterable contextStack = getContextStack(); Stack explanationStack = new Stack<>(); for (ContextStackEntry entry : contextStack) { Object data = entry.getData(); 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 5d592243c..e343c9d48 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 @@ -654,7 +654,7 @@ class Header { * * @return true if this line has end-of-comment */ - private static boolean checkLine(String line, ArrayList years) { + private static boolean checkLine(String line, List years) { if ((null == line) || (0 == line.length())) { return false; } 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 ac13870c8..fad8b560a 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 @@ -181,7 +181,7 @@ public abstract class Builder { private final File tempDir; - private final ArrayList tempFiles; + private final List tempFiles; private final boolean useEclipseCompiles; @@ -275,7 +275,7 @@ public abstract class Builder { return buildProduct(buildSpec); } Result result = specifyResultFor(buildSpec); - ArrayList errors = new ArrayList<>(); + List errors = new ArrayList<>(); try { return buildAll(result, errors); } finally { @@ -340,7 +340,7 @@ public abstract class Builder { */ protected final boolean buildAll(Result result, List errors) { Result[] buildList = skipUptodate(getAntecedantResults(result)); - ArrayList doneList = new ArrayList<>(); + List doneList = new ArrayList<>(); if ((null != buildList) && (0 < buildList.length)) { if (isLogging()) { handler.log("modules to build: " + Arrays.asList(buildList)); @@ -525,7 +525,7 @@ public abstract class Builder { } protected final boolean buildProductModule(ProductModule module) { - ArrayList errors = new ArrayList<>(); + List errors = new ArrayList<>(); try { Kind productKind = Result.kind(Result.NORMAL, Result.ASSEMBLE); Result result = module.module.getResult(productKind); @@ -543,7 +543,7 @@ public abstract class Builder { * deliverables. */ protected ProductModule[] discoverModules(File productDir, Modules modules) { - final ArrayList found = new ArrayList<>(); + final List found = new ArrayList<>(); FileFilter filter = new FileFilter() {// empty jar files public boolean accept(File file) { if ((null != file) && file.canRead() 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 3f34b3f5e..9d10e4743 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/Module.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/Module.java @@ -69,7 +69,7 @@ public class Module { /** @return all source files under srcDir */ private static Iterator sourceFiles(File srcDir) { - ArrayList result = new ArrayList<>(); + List result = new ArrayList<>(); sourceFiles(srcDir, result); return result.iterator(); } 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 563a6932e..22b92c8af 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 @@ -217,7 +217,7 @@ public class Result { /** @return List (File) of jar's required */ public List findJarRequirements() { - ArrayList result = new ArrayList<>(); + List 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 bf9b9aab9..9030bbf77 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 @@ -419,7 +419,7 @@ class Samples { } List getSortedSamples(Comparator comparer) { - ArrayList result = new ArrayList<>(samples); + List result = new ArrayList<>(samples); result.sort(comparer); return result; } diff --git a/build/src/main/java/org/aspectj/internal/tools/build/Util.java b/build/src/main/java/org/aspectj/internal/tools/build/Util.java index dd393ce45..cd7d6623f 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/Util.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/Util.java @@ -357,7 +357,7 @@ public class Util { /** unmodifiable list of all valid OSGIBundle Name's */ public static final List NAMES; static { - ArrayList names = new ArrayList<>(); + List names = new ArrayList<>(); names.add(BUNDLE_NAME); names.add(BUNDLE_SYMBOLIC_NAME); names.add(BUNDLE_VERSION); diff --git a/build/src/test/java/org/aspectj/build/BuildModuleTests.java b/build/src/test/java/org/aspectj/build/BuildModuleTests.java index f4aaa5708..46f5b15a0 100644 --- a/build/src/test/java/org/aspectj/build/BuildModuleTests.java +++ b/build/src/test/java/org/aspectj/build/BuildModuleTests.java @@ -225,7 +225,7 @@ public class BuildModuleTests extends TestCase { */ static class UnknownFileCheck implements FileFilter { private static final UnknownFileCheck SINGLETON = new UnknownFileCheck(); - private static final ArrayList STATIC_ERRORS = new ArrayList<>(); + private static final List STATIC_ERRORS = new ArrayList<>(); // Builder.BINARY_SOURCE_PATTERN and Builder.RESOURCE_PATTERN public static final List KNOWN_SUFFIXES; 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 7693ddb11..33dac2a0a 100644 --- a/build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java +++ b/build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java @@ -16,10 +16,7 @@ package org.aspectj.internal.build; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.Iterator; +import java.util.*; import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipFile; @@ -80,7 +77,7 @@ public class BuildModuleTest extends TestCase { } } - ArrayList tempFiles = new ArrayList<>(); + List tempFiles = new ArrayList<>(); private File jarDir; private boolean deleteJars; boolean building; // must be enabled for tests to run @@ -343,7 +340,7 @@ public class BuildModuleTest extends TestCase { try { zipFile = new ZipFile(weaverAllJar); Enumeration e = zipFile.entries(); - ArrayList entryNames = new ArrayList<>(); + List 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 494084e0c..6273556a5 100644 --- a/build/src/test/java/org/aspectj/internal/build/ModulesTest.java +++ b/build/src/test/java/org/aspectj/internal/build/ModulesTest.java @@ -72,7 +72,7 @@ public class ModulesTest extends TestCase { } } - ArrayList tempFiles = new ArrayList<>(); + List tempFiles = new ArrayList<>(); public ModulesTest(String name) { super(name); @@ -101,7 +101,7 @@ public class ModulesTest extends TestCase { } public void testAllModulesCreation() { - ArrayList badModules = new ArrayList<>(); + List badModules = new ArrayList<>(); for (String name: MODULE_NAMES) { File dir = new File(BASE_DIR, name); if (dir.isDirectory()) { 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 c309a3a5a..8790e964b 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 @@ -903,7 +903,7 @@ public class BuildArgParser extends Main { unparsedArgs.add(nextArg.getValue()); } - private int indexOf(LinkedList args, String arg) { + private int indexOf(Iterable args, String arg) { int index = 0; for (Arg argument : args) { if (arg.equals(argument.getValue())) { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java index 6dc405653..04693fd86 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java @@ -217,7 +217,7 @@ public class AstUtil { } public static List getAjSyntheticAttribute() { - ArrayList ret = new ArrayList(1); + List ret = new ArrayList(1); ret.add(new EclipseAttributeAdapter(new AjAttribute.AjSynthetic())); return ret; } 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 4fb176e88..35a71fd10 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 @@ -69,10 +69,10 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { private List classpath = new ArrayList<>(); private List modulepath = new ArrayList<>(); // Expensive to compute (searching modules, parsing module-info) - private ArrayList modulepathClasspathEntries = null; + private Collection modulepathClasspathEntries = null; private List modulesourcepath = new ArrayList<>(); // Expensive to compute (searching modules, parsing module-info) - private ArrayList modulesourcepathClasspathEntries = null; + private Collection modulesourcepathClasspathEntries = null; private Classpath[] checkedClasspaths = null; private List bootclasspath = new ArrayList<>(); private List cpElementsWithModifiedContents = new ArrayList<>(); diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java index 57c2f8e4c..95bd5c4c6 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.List; import java.util.ListIterator; import junit.framework.TestCase; @@ -38,7 +39,7 @@ import org.aspectj.util.FileUtil; */ public class AjdtCommandTestCase extends TestCase { - private ArrayList tempFiles = new ArrayList(); + private List tempFiles = new ArrayList(); private StreamPrintWriter outputWriter = new StreamPrintWriter(new PrintWriter(System.out)); // private AjdtCommand command = new AjdtCommand(); private MessageWriter messageWriter = new MessageWriter(outputWriter, false); 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 09ecdb34b..0d84dfc8f 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 @@ -84,7 +84,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests? if (null == targetClasses) { return false; } - final ArrayList files = new ArrayList<>(); + final List files = new ArrayList<>(); final FileFilter collector = new FileFilter() { @Override public boolean accept(File file) { @@ -94,7 +94,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests? final ICommand compiler = ReflectionFactory.makeCommand(cname, handler); - ArrayList recompiled = null; + List recompiled = null; boolean result = true; final String toSuffix = ".java"; @@ -257,7 +257,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests? List normalizeFilenames(String[] ra) { // XXX util - ArrayList result = new ArrayList<>(); + List result = new ArrayList<>(); if (null != ra) { for (String s : ra) { result.add(normalizeFilename(s)); @@ -271,7 +271,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests? /** @param list the List of File */ List normalizeFilenames(List list) { // XXX util - ArrayList result = new ArrayList<>(); + List result = new ArrayList<>(); for (File file: list) { // for (Iterator iter = list.iterator(); iter.hasNext();) { result.add(normalizeFilename(file.getPath())); 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 de8960e73..b38e8166c 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/ASTVisitorTest.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/ASTVisitorTest.java @@ -421,7 +421,7 @@ public class ASTVisitorTest extends TestCase { private void checkJLS3(String source, String expectedOutput) { ASTParser parser = ASTParser.newParser(AST.JLS3); - HashMap options = new HashMap<>(); + Map 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/AjcTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java index 518f944c8..91fbc9b86 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 @@ -787,7 +787,7 @@ public abstract class AjcTestCase extends TestCase { private ListtokenizeCommand(String command) { StringTokenizer st = new StringTokenizer(command," ", false); - ArrayList arguments = new ArrayList<>(); + List arguments = new ArrayList<>(); while(st.hasMoreElements()){ String nextToken =st.nextToken(); arguments.add(nextToken); 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 7da3aa647..ddcd1046a 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 @@ -13,6 +13,7 @@ package org.aspectj.tools.ajc; import java.util.ArrayList; +import java.util.List; import java.util.ResourceBundle; import org.aspectj.bridge.AbortException; @@ -23,7 +24,7 @@ import org.aspectj.bridge.AbortException; public class MainTest extends AjcTestCase { public void testMainbare() { - ArrayList list = new ArrayList<>(); + List 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/CrosscuttingMembers.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java index d380e988e..e71850c05 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 @@ -74,8 +74,8 @@ public class CrosscuttingMembers { this.shouldConcretizeIfNeeded = shouldConcretizeIfNeeded; } - private final Hashtable cflowFields = new Hashtable<>(); - private final Hashtable cflowBelowFields = new Hashtable<>(); + private final Map cflowFields = new Hashtable<>(); + private final Map cflowBelowFields = new Hashtable<>(); // public void addConcreteShadowMungers(Collection c) { // shadowMungers.addAll(c); 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 293a7766c..9a322d98f 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 @@ -1425,13 +1425,13 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * ??? This method is O(N*M) where N = number of methods and M is number of inter-type declarations in my super */ public List getInterTypeMungersIncludingSupers() { - ArrayList ret = new ArrayList<>(); + List ret = new ArrayList<>(); collectInterTypeMungers(ret); return ret; } public List getInterTypeParentMungersIncludingSupers() { - ArrayList ret = new ArrayList<>(); + List ret = new ArrayList<>(); collectInterTypeParentMungers(ret); return ret; } 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 c6ebb14b3..c055290ae 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 @@ -2037,7 +2037,7 @@ public class AjcTask extends MatchingTask { // } List extractArguments() { - ArrayList result = new ArrayList(); + List result = new ArrayList(); String[] cmds = command.getArguments(); if (!LangUtil.isEmpty(cmds)) { result.addAll(Arrays.asList(cmds)); diff --git a/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java b/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java index 80e9ed4a0..3a5f3b954 100644 --- a/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java +++ b/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java @@ -20,6 +20,7 @@ import org.aspectj.util.FileUtil; import java.io.File; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import junit.framework.TestCase; @@ -28,7 +29,7 @@ import junit.framework.TestCase; */ public class Ajc11CompilerAdapterTest extends TestCase { public static boolean LOGGING = false; - ArrayList tempFiles = new ArrayList(); + List tempFiles = new ArrayList(); public Ajc11CompilerAdapterTest(String name) { super(name); diff --git a/testing-client/src/main/java/org/aspectj/testing/Tester.java b/testing-client/src/main/java/org/aspectj/testing/Tester.java index d42bcd994..8e6e98db4 100644 --- a/testing-client/src/main/java/org/aspectj/testing/Tester.java +++ b/testing-client/src/main/java/org/aspectj/testing/Tester.java @@ -720,7 +720,7 @@ public class Tester { private static String[] diffIgnoreDups(Collection set, String[] expected, String msg, boolean ignoreDups) { ArrayList result = new ArrayList<>(); - ArrayList actual = new ArrayList<>(set); + List actual = new ArrayList<>(set); BitSet hits = new BitSet(); for (int i = 0; i < expected.length; i++) { if (!actual.remove(expected[i])) { diff --git a/testing-client/src/test/java/org/aspectj/testing/TesterTest.java b/testing-client/src/test/java/org/aspectj/testing/TesterTest.java index 5533739a3..e757dfc4b 100644 --- a/testing-client/src/test/java/org/aspectj/testing/TesterTest.java +++ b/testing-client/src/test/java/org/aspectj/testing/TesterTest.java @@ -166,8 +166,8 @@ public class TesterTest extends TestCase { * @author isberg */ public static class MyTestReporter implements IMessageHandler { - public ArrayList failures = new ArrayList<>(); - public ArrayList passes = new ArrayList<>(); + public List failures = new ArrayList<>(); + public List passes = new ArrayList<>(); public void clear() { failures.clear(); diff --git a/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java b/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java index 42f4c4451..751a035fa 100644 --- a/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java +++ b/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java @@ -176,7 +176,7 @@ public class Harness { /** just don't say anything! */ protected boolean silentHarness; - private HashMap features; + private Map features; /** if true, do not delete temporary files. */ private boolean keepTemp; @@ -212,7 +212,7 @@ public class Harness { LangUtil.throwIaxIfFalse(!LangUtil.isEmpty(args), "empty args"); // read arguments final ArrayList globals = new ArrayList<>(); - final ArrayList files = new ArrayList<>(); + final List files = new ArrayList<>(); final LinkedList argList = new LinkedList<>(Arrays.asList(args)); for (int i = 0; i < argList.size(); i++) { String arg = argList.get(i); @@ -604,7 +604,7 @@ public class Harness { /** print known aliases at the end of the syntax message */ protected void printAliases(PrintStream out) { LangUtil.throwIaxIfNull(out, "out"); - Properties props = getOptionAliases(); + Map props = getOptionAliases(); if (null == props) { return; } @@ -699,7 +699,7 @@ class FeatureHarness extends Harness { "-junit" + OPTION_DELIM + "-ajctestSkipKeywords=knownLimitation,purejava" }; static { - Properties optionAliases = Harness.getOptionAliases(); + Map optionAliases = Harness.getOptionAliases(); if (null != optionAliases) { for (int i = 1; i < ALIASES.length; i += 2) { optionAliases.put(ALIASES[i-1], ALIASES[i]); @@ -941,7 +941,7 @@ class TestMaker { } public Harness.RunResult run(AjcTest.Suite.Spec spec) { - ArrayList kids = spec.getChildren(); + Iterable kids = spec.getChildren(); for (IRunSpec iRunSpec : kids) { makeTest( (AjcTest.Spec) iRunSpec); } 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 cf615f6d1..ed4f560c0 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 @@ -83,7 +83,7 @@ abstract public class AbstractRunSpec implements IRunSpec { private boolean skipAll; protected String xmlElementName; // nonfinal only for clone() - protected final ArrayList keywords; + protected final List keywords; protected final IMessageHolder /* IMessage */messages; protected final ArrayList options; protected final ArrayList paths; @@ -197,7 +197,7 @@ abstract public class AbstractRunSpec implements IRunSpec { } } - public ArrayList getKeywordsList() { + public List getKeywordsList() { return makeList(keywords); } @@ -257,7 +257,7 @@ abstract public class AbstractRunSpec implements IRunSpec { // --------------- (String) paths /** @return ArrayList of String paths */ - public ArrayList getPathsList() { + public List getPathsList() { return makeList(paths); } diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java index 52a3e2266..2ff173362 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java @@ -250,7 +250,7 @@ public class AjcSpecTest extends TestCase { sameDirChangesList(lhs.dirChanges, rhs.dirChanges, a); } - public static void sameDirChangesList(ArrayList lhs, ArrayList rhs, Assert a) { + public static void sameDirChangesList(List lhs, List rhs, Assert a) { if ((null == lhs) && (null == rhs)) { return; } 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 7bbc50adf..5ca41509f 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 @@ -161,7 +161,7 @@ public class AjcTest extends RunSpecIterator { * @return the unmodifiable List of titles (maybe empty, never null) */ private static List parseTitlesList(String titlesList) { - ArrayList result = new ArrayList<>(); + List result = new ArrayList<>(); String last = null; StringTokenizer st = new StringTokenizer(titlesList, ","); while (st.hasMoreTokens()) { @@ -206,7 +206,7 @@ public class AjcTest extends RunSpecIterator { * @return the unmodifiable List of titles (maybe empty, never null) */ private static List readTitlesFile(File titlesFile, boolean fail) { - ArrayList result = new ArrayList<>(); + List result = new ArrayList<>(); Reader reader = null; try { reader = new FileReader(titlesFile); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRun.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRun.java index 7a5bff3df..25ca084bf 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRun.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRun.java @@ -729,7 +729,7 @@ public class CompilerRun implements IAjcRun { private static String updateBootclasspathForSourceVersion( String sourceVersion, String compilerName, - ArrayList toAdd) { + List toAdd) { if (null == sourceVersion) { return null; } @@ -1497,7 +1497,7 @@ public class CompilerRun implements IAjcRun { String seek; /** if setup completed, this has the combined global/local options */ - ArrayList commandOptions; + List commandOptions; public Object clone() { TestSetup testSetup = new TestSetup(); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChanges.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChanges.java index e3e60e028..18b05982c 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChanges.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChanges.java @@ -469,19 +469,19 @@ public class DirChanges { boolean fastFail; /** relative paths (String) of expected files added */ - final ArrayList added; + final List added; /** relative paths (String) of expected files removed/deleted */ - final ArrayList removed; + final List removed; /** relative paths (String) of expected files updated/changed */ - final ArrayList updated; + final List updated; /** relative paths (String) of expected files NOT * added, removed, or changed * XXX unchanged unimplemented */ - final ArrayList unchanged; + final List unchanged; public Spec() { added = new ArrayList<>(); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java index 28db821cb..696d491a5 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java @@ -150,7 +150,7 @@ public class FlatSuiteReader implements SFileReader.Maker { throw new AbortException("expected sources at " + reader); } - ArrayList exp = new ArrayList<>(); + List exp = new ArrayList<>(); // !compile || noerrors || className {runOption..} String first = words[0]; if ("!compile".equals(first)) { @@ -290,7 +290,7 @@ public class FlatSuiteReader implements SFileReader.Maker { result.description = input; ArrayList newOptions = new ArrayList<>(); - ArrayList optionsCopy = result.getOptionsList(); + Iterable optionsCopy = result.getOptionsList(); for (String option: optionsCopy) { if (option.startsWith("-")) { newOptions.add("!" + option.substring(1)); @@ -325,7 +325,7 @@ public class FlatSuiteReader implements SFileReader.Maker { */ private List makeMessages(// XXX weak - also support expected exceptions, etc. Kind kind, String[] words, int start, File lastFile) { - ArrayList result = new ArrayList<>(); + List result = new ArrayList<>(); for (int i = start; i < words.length; i++) { ISourceLocation sl = BridgeUtil.makeSourceLocation(words[i], lastFile); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/Globals.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/Globals.java index ad62c9735..22e52ec61 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/Globals.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/Globals.java @@ -71,7 +71,7 @@ public class Globals { && FileUtil.canReadFile(F_aspectjrt_jar) && FileUtil.canReadFile(J2SE13_RTJAR) && FileUtil.canReadFile(J2SE14_RTJAR)); - HashMap map = new HashMap(); + Map map = new HashMap(); map.put("1.2", "java.lang.ref.Reference"); map.put("1.3", "java.lang.reflect.Proxy"); map.put("1.4", "java.nio.Buffer"); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/IncCompilerRun.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/IncCompilerRun.java index a0c48878e..e3bbb9209 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/IncCompilerRun.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/IncCompilerRun.java @@ -409,7 +409,7 @@ public class IncCompilerRun implements IAjcRun { addItems(classesRemoved, items); } - private void addItems(ArrayList list, String items) { + private void addItems(List list, String items) { if (null != items) { String[] classes = XMLWriter.unflattenList(items); if (!LangUtil.isEmpty(classes)) { diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/Validator.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/Validator.java index a0b4f5e96..1bda6adda 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/Validator.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/Validator.java @@ -13,12 +13,7 @@ package org.aspectj.testing.harness.bridge; import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.ListIterator; -import java.util.Stack; +import java.util.*; import org.aspectj.bridge.AbortException; import org.aspectj.bridge.IMessage; @@ -51,10 +46,10 @@ public class Validator { private final Stack handlers; /** list of File registered for deletion on demand */ - private final ArrayList tempFiles; // deleteTempFiles requires ListIterator.remove() + private final List tempFiles; // deleteTempFiles requires ListIterator.remove() /** list of Sandboxes registered for cleanup on demand */ - private final ArrayList sandboxes; + private final List sandboxes; /** if true, throw AbortException on failure */ boolean abortOnFailure; diff --git a/testing/src/test/java/org/aspectj/testing/run/RunListeners.java b/testing/src/test/java/org/aspectj/testing/run/RunListeners.java index 4eb8e7a74..ebdc227d0 100644 --- a/testing/src/test/java/org/aspectj/testing/run/RunListeners.java +++ b/testing/src/test/java/org/aspectj/testing/run/RunListeners.java @@ -16,6 +16,7 @@ package org.aspectj.testing.run; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; /** * Aggregate listeners into one and run synchronously in order added. @@ -23,7 +24,7 @@ import java.util.Iterator; */ public class RunListeners extends RunListener implements IRunListener { - ArrayList listeners; + List listeners; public RunListeners() { listeners = new ArrayList(); } 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 3871ee74b..b20a5650a 100644 --- a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java +++ b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java @@ -14,6 +14,7 @@ package org.aspectj.testing.taskdefs; import java.io.File; import java.util.ArrayList; +import java.util.List; import org.aspectj.bridge.IMessageHolder; import org.aspectj.bridge.MessageHandler; @@ -33,7 +34,7 @@ import junit.framework.TestCase; public class AjcTaskCompileCommandTest extends TestCase { static boolean loggedWarning = false; static boolean runAllTests = true; - static ArrayList tempFiles = new ArrayList<>(); + static List tempFiles = new ArrayList<>(); private static File getClassesDir() { File tempDir = FileUtil.getTempDir("AjcTaskCompileCommandTest-classes"); @@ -41,7 +42,7 @@ public class AjcTaskCompileCommandTest extends TestCase { return tempDir; } - private static void addCommonArgs(ArrayList list) { + private static void addCommonArgs(List list) { list.add("-d"); list.add(getClassesDir().getAbsolutePath()); list.add("-classpath"); 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 e95ab3184..43739b752 100644 --- a/testing/src/test/java/org/aspectj/testing/util/Diffs.java +++ b/testing/src/test/java/org/aspectj/testing/util/Diffs.java @@ -148,8 +148,8 @@ public class Diffs { IMessage[] actual, IMessage.Kind[] ignoreExpectedKinds, IMessage.Kind[] ignoreActualKinds) { - ArrayList exp = getExcept(expected, ignoreExpectedKinds); - ArrayList act = getExcept(actual, ignoreActualKinds); + List exp = getExcept(expected, ignoreExpectedKinds); + List act = getExcept(actual, ignoreActualKinds); ArrayList missing = new ArrayList(); List unexpected = new ArrayList(); @@ -161,8 +161,8 @@ public class Diffs { } else { ListIterator expectedIterator = exp.listIterator(); int lastLine = Integer.MIN_VALUE + 1; - ArrayList expectedFound = new ArrayList(); - ArrayList expectedForLine = new ArrayList(); + List expectedFound = new ArrayList(); + List expectedForLine = new ArrayList(); for (ListIterator iter = act.listIterator(); iter.hasNext();) { IMessage actualMessage = (IMessage) iter.next(); int actualLine = getLine(actualMessage); diff --git a/testing/src/test/java/org/aspectj/testing/util/FileUtil.java b/testing/src/test/java/org/aspectj/testing/util/FileUtil.java index 71dfb7f2e..4f9f56424 100644 --- a/testing/src/test/java/org/aspectj/testing/util/FileUtil.java +++ b/testing/src/test/java/org/aspectj/testing/util/FileUtil.java @@ -25,12 +25,7 @@ import java.io.StringBufferInputStream; import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; +import java.util.*; import java.util.jar.Attributes; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; @@ -131,7 +126,7 @@ public class FileUtil { final boolean checkExpected = !LangUtil.isEmpty(expectedPaths); // normalize sources to ignore - final ArrayList expected = (!checkExpected ? null : new ArrayList()); + final List expected = (!checkExpected ? null : new ArrayList()); if (checkExpected) { for (String srcPath : expectedPaths) { if (!LangUtil.isEmpty(srcPath)) { @@ -186,7 +181,7 @@ public class FileUtil { return false; } }; - ArrayList unexp = new ArrayList(Arrays.asList(dir.listFiles(touchedCollector))); + List unexp = new ArrayList(Arrays.asList(dir.listFiles(touchedCollector))); // report any unexpected changes return Diffs.makeDiffs(label, expected, unexp, String.CASE_INSENSITIVE_ORDER); diff --git a/testing/src/test/java/org/aspectj/testing/util/LangUtil.java b/testing/src/test/java/org/aspectj/testing/util/LangUtil.java index ad9331dd3..b4acc5ce3 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LangUtil.java +++ b/testing/src/test/java/org/aspectj/testing/util/LangUtil.java @@ -402,7 +402,7 @@ public class LangUtil { * @see Util#combine(Object[], Object[]) */ public static String[] combine(String[] one, String[] two) { - ArrayList twoList = new ArrayList(org.aspectj.util.LangUtil.arrayAsList(two)); + List twoList = new ArrayList(org.aspectj.util.LangUtil.arrayAsList(two)); ArrayList result = new ArrayList(); if (null != one) { for (String s : one) { @@ -938,10 +938,10 @@ public class LangUtil { return; } - ArrayList expected = new ArrayList(expectedListIn); + List expected = new ArrayList(expectedListIn); expected.sort(comparator); - ArrayList actual = new ArrayList(actualListIn); + List actual = new ArrayList(actualListIn); actual.sort(comparator); Iterator actualIter = actual.iterator(); Object act = null; diff --git a/testing/src/test/java/org/aspectj/testing/util/LangUtilTest.java b/testing/src/test/java/org/aspectj/testing/util/LangUtilTest.java index 6eede56a6..853e51f50 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LangUtilTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/LangUtilTest.java @@ -67,7 +67,7 @@ public class LangUtilTest extends TestCase { void checkUnflatten(FTest test) { String[] exp = test.unflattened; - ArrayList result = LangUtil.unflatten(test.toUnflatten, test.spec); + List result = LangUtil.unflatten(test.toUnflatten, test.spec); String label = test + " -> " + result; assertNotNull(label, result); @@ -96,7 +96,7 @@ public class LangUtilTest extends TestCase { public void testArrayList() { - ArrayList l = new ArrayList(); + List l = new ArrayList(); l.add(null); l.add(null); assertTrue(null == l.get(0)); @@ -269,15 +269,15 @@ public class LangUtilTest extends TestCase { if (unmodifiable) { return Collections.unmodifiableList(Arrays.asList(ra)); } else { - ArrayList list = new ArrayList(Arrays.asList(ra)); + List list = new ArrayList(Arrays.asList(ra)); return list; } } /** check both hard and soft - assuming list contain String */ void checkDiff(List expected, List actual, List missing, List extra) { - ArrayList extraOut = new ArrayList(); - ArrayList missingOut = new ArrayList(); + List extraOut = new ArrayList(); + List missingOut = new ArrayList(); LangUtil.makeDiffs(expected, actual, missingOut, extraOut); checkSame(missing, missingOut); checkSame(extra, extraOut); @@ -301,8 +301,8 @@ public class LangUtilTest extends TestCase { /** check only soft - assuming list contain String */ void checkDiffSoft(List expected, List actual, List missing, List extra) { - ArrayList extraOut = new ArrayList(); - ArrayList missingOut = new ArrayList(); + List extraOut = new ArrayList(); + List missingOut = new ArrayList(); LangUtil.makeSoftDiffs(expected, actual, missingOut, extraOut, String.CASE_INSENSITIVE_ORDER); checkSameSoft(missing, missingOut); @@ -316,8 +316,8 @@ public class LangUtilTest extends TestCase { String label = one + "?=" + two; assertTrue(label, (null == one) == (null == two)); if (null != one) { - ArrayList aone = new ArrayList(one); - ArrayList atwo = new ArrayList(); + List aone = new ArrayList(one); + List atwo = new ArrayList(); aone.addAll(two); Collections.sort(aone); Collections.sort(atwo); 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 a576c4ae4..17dff157e 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java +++ b/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java @@ -171,10 +171,10 @@ public class LinkCheck { private final Messages messages; private final HTMLEditorKit.Parser parser; // XXX untested - stateful - private final ArrayList linksToCheck; - private final ArrayList checkedUrls; // String (URL.toString) - private final ArrayList validRefs; // String (URL.toString) - private final ArrayList refsToCheck; // String (URL.toString) + private final List linksToCheck; + private final List checkedUrls; // String (URL.toString) + private final List validRefs; // String (URL.toString) + private final List refsToCheck; // String (URL.toString) private final Link.Check checkExists; private final Link.Check checkContents; @@ -221,7 +221,7 @@ public class LinkCheck { } public synchronized void run() { - ArrayList list = new ArrayList<>(); + List list = new ArrayList<>(); while (0 < linksToCheck.size()) { messages.checkingLinks(linksToCheck.size()); list.clear(); diff --git a/testing/src/test/java/org/aspectj/testing/util/MessageUtilTest.java b/testing/src/test/java/org/aspectj/testing/util/MessageUtilTest.java index abfff1ee6..9dc379d84 100644 --- a/testing/src/test/java/org/aspectj/testing/util/MessageUtilTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/MessageUtilTest.java @@ -71,7 +71,7 @@ public class MessageUtilTest extends TestCase { List getSampleMessageTexts() { if (null == messageTexts) { - ArrayList result = new ArrayList(Arrays.asList(new String[] + List result = new ArrayList(Arrays.asList(new String[] {"one", "two", "now is the time for all good men..."})); messageTexts = result; } @@ -80,7 +80,7 @@ public class MessageUtilTest extends TestCase { List getSampleExceptions() { if (null == exceptions) { - ArrayList result = new ArrayList(); + List result = new ArrayList(); int i = 1; result.add(new Error("Error " + i++)); result.add(new RuntimeException("RuntimeException " + i++)); @@ -92,7 +92,7 @@ public class MessageUtilTest extends TestCase { List getSampleLocations() { if (null == locations) { - ArrayList result = new ArrayList(); + List result = new ArrayList(); File file = new File("testsrc/org/aspectj/testing/util/MessageUtilTest.java"); result.add(new SourceLocation(file, 1, 2, 1)); result.add(new SourceLocation(file, 100, 100, 0)); diff --git a/testing/src/test/java/org/aspectj/testing/util/TestClassLoader.java b/testing/src/test/java/org/aspectj/testing/util/TestClassLoader.java index 8a753dfc7..559df2a0f 100644 --- a/testing/src/test/java/org/aspectj/testing/util/TestClassLoader.java +++ b/testing/src/test/java/org/aspectj/testing/util/TestClassLoader.java @@ -41,7 +41,7 @@ public class TestClassLoader extends URLClassLoader { super(urls); this.urlsForDebugString = urls; LangUtil.throwIaxIfComponentsBad(dirs, "dirs", null); - ArrayList dcopy = new ArrayList(); + List dcopy = new ArrayList(); if (!LangUtil.isEmpty(dirs)) { dcopy.addAll(Arrays.asList(dirs)); diff --git a/testing/src/test/java/org/aspectj/testing/util/TestDiffs.java b/testing/src/test/java/org/aspectj/testing/util/TestDiffs.java index 11dd15587..09391bd6d 100644 --- a/testing/src/test/java/org/aspectj/testing/util/TestDiffs.java +++ b/testing/src/test/java/org/aspectj/testing/util/TestDiffs.java @@ -83,8 +83,8 @@ public class TestDiffs { // XXX pretty dumb implementation Diffs tests = Diffs.makeDiffs("tests", exp, act, TestResult.BY_NAME); // remove missing/unexpected (removed, added) tests from results // otherwise, unexpected-[pass|fail] look like [fixes|broken] - ArrayList expResults = trimByName(exp, tests.missing); - ArrayList actResults = trimByName(act, tests.unexpected); + List expResults = trimByName(exp, tests.missing); + List actResults = trimByName(act, tests.unexpected); Diffs results = Diffs.makeDiffs("results", expResults, actResults, TestResult.BY_PASSNAME); @@ -159,7 +159,7 @@ public class TestDiffs { // XXX pretty dumb implementation /** split input List by whether the TestResult element passed or failed */ - private static void split(List input, ArrayList pass, ArrayList fail) { + private static void split(List input, List pass, List fail) { for (Object o : input) { TestResult result = (TestResult) o; if (result.pass) { diff --git a/testing/src/test/java/org/aspectj/testing/util/TestDiffsTest.java b/testing/src/test/java/org/aspectj/testing/util/TestDiffsTest.java index 17fa8234d..a0c5e115f 100644 --- a/testing/src/test/java/org/aspectj/testing/util/TestDiffsTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/TestDiffsTest.java @@ -18,6 +18,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.List; import java.util.ListIterator; import org.aspectj.util.FileUtil; @@ -67,7 +68,7 @@ public class TestDiffsTest extends TestCase { } } - ArrayList tempFiles; + List tempFiles; /** * Constructor for FileUtilTest. * @param arg0 diff --git a/testing/src/test/java/org/aspectj/testing/util/options/Option.java b/testing/src/test/java/org/aspectj/testing/util/options/Option.java index b9c6d2cab..5d3ec4ba6 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/Option.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/Option.java @@ -365,7 +365,7 @@ public class Option implements Comparable { private final Map familyNameToFamily = new TreeMap(); /** enforce uniqueness of options */ - private final ArrayList names = new ArrayList(); + private final List names = new ArrayList(); public Factory(String factoryName) { this.factoryName = factoryName; diff --git a/testing/src/test/java/org/aspectj/testing/util/options/Options.java b/testing/src/test/java/org/aspectj/testing/util/options/Options.java index 92e84c106..03b3a6d51 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/Options.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/Options.java @@ -14,6 +14,7 @@ package org.aspectj.testing.util.options; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import org.aspectj.util.LangUtil; @@ -59,7 +60,7 @@ public class Options { return sb.toString(); } - private final ArrayList options = new ArrayList(); + private final List options = new ArrayList(); private final boolean stopAtFirstMatch; private boolean frozen = !FROZEN; 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 d6ebc774e..b60e56470 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReaderTest.java +++ b/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReaderTest.java @@ -21,6 +21,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import org.aspectj.testing.harness.bridge.AjcSpecTest; import org.aspectj.testing.harness.bridge.AjcTest; @@ -35,7 +36,7 @@ import junit.framework.TestCase; */ public class AjcSpecXmlReaderTest extends TestCase { - ArrayList tempFiles = new ArrayList<>(); + List tempFiles = new ArrayList<>(); /** * Constructor for AjcSpecXmlReaderTest. * @param name @@ -111,7 +112,7 @@ public class AjcSpecXmlReaderTest extends TestCase { String xml2Path = path + ".tmp.xml"; final File file1 = new File(xmlPath); - final ArrayList toDelete = new ArrayList<>(); + final List toDelete = new ArrayList<>(); final AjcSpecXmlReader writer = AjcSpecXmlReader.getReader(); assertTrue("" + file1, file1.canRead()); @@ -154,7 +155,7 @@ public class AjcSpecXmlReaderTest extends TestCase { AjcSpecXmlReader writer = AjcSpecXmlReader.getReader(); File file0 = new File(txtPath); File file1 = new File(xmlPath); - ArrayList toDelete = new ArrayList<>(); + List toDelete = new ArrayList<>(); AjcTest.Suite.Spec suite0 = null; if (file0.canRead()) { System.out.println("reading " + file0); diff --git a/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReaderTest.java b/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReaderTest.java index 342484a76..3201d4288 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReaderTest.java +++ b/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReaderTest.java @@ -16,6 +16,7 @@ package org.aspectj.testing.xml; import java.io.File; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import org.aspectj.bridge.IMessage; import org.aspectj.util.LangUtil; @@ -27,7 +28,7 @@ import junit.framework.TestCase; */ public class MessageListXmlReaderTest extends TestCase { - ArrayList tempFiles = new ArrayList(); + List tempFiles = new ArrayList(); public MessageListXmlReaderTest(String name) { super(name); } diff --git a/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java b/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java index 969c8ecd8..8199e3826 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java +++ b/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java @@ -41,7 +41,7 @@ public class SoftMessage implements IMessage { private String details; private int id; private int sourceStart,sourceEnd; - private final ArrayList extraSourceLocations = new ArrayList(); + private final List extraSourceLocations = new ArrayList(); //private ISourceLocation pseudoSourceLocation; // set directly // collapse enclosed source location for shorter, property-based xml 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 5e6708a2e..086c8ce95 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 @@ -14,6 +14,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; +import java.util.Map; import org.aspectj.util.FileUtil; @@ -42,7 +43,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj configureProcessorOptions("ProcessorConsumer1","DemoProcessor"); configureNonStandardCompileOptions("ProcessorConsumer1", "-showWeaveInfo"); - Hashtable javaOptions = new Hashtable<>(); + Map 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 +71,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj configureProcessorPath("ProcessorConsumer2", getCompilerForProjectWithName("ProcessorProject2").getCompilerConfiguration().getOutputLocationManager().getDefaultOutputLocation().toString()+File.pathSeparator+ new File(testdataSrcDir + File.separatorChar + "ProcessorProject2" + File.separatorChar + "base"+File.separatorChar+"src").toString()); - Hashtable javaOptions = new Hashtable<>(); + Map 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 +109,7 @@ public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAj configureNonStandardCompileOptions("ProcessorConsumer1", "-showWeaveInfo"); - Hashtable javaOptions = new Hashtable<>(); + Map 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"); 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 36be6773e..b3ae1b6c1 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java @@ -107,7 +107,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio if (javaOptionsMap != null && !javaOptionsMap.isEmpty()) return javaOptionsMap; - Hashtable ht = new Hashtable<>(); + Map 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"); 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 49663211f..3c3b0c72d 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 @@ -808,7 +808,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa String p = "pr266420"; initialiseProject(p); - Hashtable javaOptions = new Hashtable<>(); + Map 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"); @@ -3614,7 +3614,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testPR164384_1() { initialiseProject("PR164384"); - Hashtable javaOptions = new Hashtable<>(); + Map javaOptions = new Hashtable<>(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); @@ -3646,7 +3646,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testPR164384_2() { initialiseProject("PR164384"); - Hashtable javaOptions = new Hashtable<>(); + Map javaOptions = new Hashtable<>(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5"); @@ -3676,7 +3676,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testPR164384_3() { initialiseProject("PR164384"); - Hashtable javaOptions = new Hashtable<>(); + Map 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"); diff --git a/util/src/main/java/org/aspectj/util/FileUtil.java b/util/src/main/java/org/aspectj/util/FileUtil.java index a586b69f6..363056491 100644 --- a/util/src/main/java/org/aspectj/util/FileUtil.java +++ b/util/src/main/java/org/aspectj/util/FileUtil.java @@ -1294,7 +1294,7 @@ public class FileUtil { * @param List sink the List for String entries of the form {sourcePath}:line:column * @return String error if any, or add String entries to sink */ - public static String lineSeek(String sought, String sourcePath, boolean listAll, ArrayList sink) { + public static String lineSeek(String sought, String sourcePath, boolean listAll, List sink) { if (LangUtil.isEmpty(sought) || LangUtil.isEmpty(sourcePath)) { return "nothing sought"; } diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java index e97438b0e..edfc48f70 100644 --- a/util/src/main/java/org/aspectj/util/LangUtil.java +++ b/util/src/main/java/org/aspectj/util/LangUtil.java @@ -359,7 +359,7 @@ public class LangUtil { if (null == input) { return Collections.emptyList(); } - ArrayList result = new ArrayList<>(); + List result = new ArrayList<>(); if (LangUtil.isEmpty(delim) || (!input.contains(delim))) { result.add(input.trim()); @@ -741,7 +741,7 @@ public class LangUtil { final int sinkLength = (null == sink ? 0 : sink.length); final int resultSize; - ArrayList result = null; + List result = null; if (0 == sourceLength) { resultSize = 0; } else { @@ -1000,7 +1000,7 @@ public class LangUtil { if ((null == array) || (1 > array.length)) { return Collections.emptyList(); } - ArrayList list = new ArrayList<>(Arrays.asList(array)); + List list = new ArrayList<>(Arrays.asList(array)); return list; } diff --git a/util/src/main/java/org/aspectj/util/UtilClassLoader.java b/util/src/main/java/org/aspectj/util/UtilClassLoader.java index b4d09533f..2cb522f90 100644 --- a/util/src/main/java/org/aspectj/util/UtilClassLoader.java +++ b/util/src/main/java/org/aspectj/util/UtilClassLoader.java @@ -40,7 +40,7 @@ public class UtilClassLoader extends URLClassLoader { super(urls); LangUtil.throwIaxIfNotAssignable(dirs, File.class, "dirs"); this.urlsForDebugString = urls; - ArrayList dcopy = new ArrayList<>(); + List 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 f5466e2cf..29cd246e4 100644 --- a/util/src/test/java/org/aspectj/util/FileUtilTest.java +++ b/util/src/test/java/org/aspectj/util/FileUtilTest.java @@ -62,7 +62,7 @@ public class FileUtilTest extends TestCase { * @throws AssertionFailedError if any names are not in dir */ public static String[] dirContains(File dir, final String[] filenames) { - final ArrayList sought = new ArrayList<>(LangUtil.arrayAsList(filenames)); + final List sought = new ArrayList<>(LangUtil.arrayAsList(filenames)); FilenameFilter filter = new FilenameFilter() { public boolean accept(File d, String name) { return !sought.remove(name); @@ -188,7 +188,7 @@ public class FileUtilTest extends TestCase { } /** List of File files or directories to delete when exiting */ - final ArrayList tempFiles; + final List tempFiles; public FileUtilTest(String s) { super(s); @@ -388,7 +388,7 @@ public class FileUtilTest extends TestCase { } public void testRandomFileString() { - ArrayList results = new ArrayList<>(); + List results = new ArrayList<>(); for (int i = 0; i < 1000; i++) { String s = FileUtil.randomFileString(); if (results.contains(s)) { @@ -462,7 +462,7 @@ public class FileUtilTest extends TestCase { List sourceList = new ArrayList<>(); sourceList.add(file.getPath()); - final ArrayList errors = new ArrayList<>(); + final List errors = new ArrayList<>(); final PrintStream errorSink = new PrintStream(System.err, true) { public void println(String error) { errors.add(error); @@ -502,7 +502,7 @@ public class FileUtilTest extends TestCase { tempFiles.add(file); } // now test - final ArrayList errors = new ArrayList<>(); + final List 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/BcelWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java index b80080ec1..110d58c88 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java @@ -946,7 +946,7 @@ public class BcelWeaver { manifest = new Manifest(); - Attributes attributes = manifest.getMainAttributes(); + Map attributes = manifest.getMainAttributes(); attributes.put(Name.MANIFEST_VERSION, WEAVER_MANIFEST_VERSION); attributes.put(CREATED_BY, WEAVER_CREATED_BY); } 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 cd378dbbf..76acc6e7f 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java @@ -352,12 +352,12 @@ public class ClassPathManager { FileSystem fs = null; try { if (LangUtil.is19VMOrGreater()) { - HashMap env = new HashMap<>(); + Map env = new HashMap<>(); env.put("java.home", jdkHome); fs = FileSystems.newFileSystem(JRT_URI, env); } else { URLClassLoader loader = new URLClassLoader(new URL[] { jrtPath }); - HashMap env = new HashMap<>(); + Map env = new HashMap<>(); fs = FileSystems.newFileSystem(JRT_URI, env, loader); } state = new JImageState(jrtFsPath, fs); 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 7e2541e6c..7bac02dad 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -1359,7 +1359,7 @@ public final class LazyMethodGen implements Traceable { } private void addExceptionHandlers(MethodGen gen, Map map, - LinkedList exnList) { + Iterable exnList) { // now add exception handlers for (ExceptionRange r : exnList) { if (r.isEmpty()) { @@ -1547,7 +1547,7 @@ public final class LazyMethodGen implements Traceable { // but I don't trust the only implementation, TreeSet, to do the right // thing. - /* private */static void insertHandler(ExceptionRange fresh, LinkedList l) { + /* private */static void insertHandler(ExceptionRange fresh, List l) { // Old implementation, simply: l.add(0,fresh); for (ListIterator iter = l.listIterator(); iter.hasNext();) { ExceptionRange r = iter.next(); diff --git a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java index e49988a89..8d912a317 100644 --- a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java +++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java @@ -253,7 +253,7 @@ public class SimpleAOPParser { private static void traverse(SimpleAOPParser sap, LightXMLParser xml) throws Exception { sap.startElement(xml.getName(), xml.getAttributes()); - ArrayList childrens = xml.getChildrens(); + Iterable childrens = xml.getChildrens(); for (Object children : childrens) { LightXMLParser child = (LightXMLParser) children; traverse(sap, child); diff --git a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java index f9b020272..fbe505292 100644 --- a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java @@ -191,13 +191,13 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable02() { List list = new ArrayList(); - ArrayList arraylist = null; + List arraylist = null; List listOfString = new ArrayList<>(); List listOfSomething = new ArrayList(); - ArrayList arrayListOfSomething = null; + List arrayListOfSomething = null; List listOfNumber = null; ArrayList arrayListOfNumber = null; - ArrayList arrayListOfSomethingNumberish = null; + List arrayListOfSomethingNumberish = null; List listOfSomethingNumberish = new ArrayList(); List listOfSomethingSuperDouble = new ArrayList(); List listOfInteger = new ArrayList<>(); @@ -274,14 +274,14 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable03_method_m2() { List list = new ArrayList(); - ArrayList arraylist = null; + List arraylist = null; List listOfString = new ArrayList<>(); List listOfSomething = new ArrayList(); - ArrayList arrayListOfSomething = null; + List arrayListOfSomething = null; List listOfNumber = null; - ArrayList arrayListOfNumber = null; - ArrayList arrayListOfInteger = null; - ArrayList arrayListOfSomethingNumberish = null; + List arrayListOfNumber = null; + List arrayListOfInteger = null; + List arrayListOfSomethingNumberish = null; List listOfSomethingNumberish = new ArrayList(); List listOfSomethingSuperDouble = new ArrayList(); List listOfInteger = new ArrayList<>(); @@ -364,15 +364,15 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList arraylist = null; List listOfString = new ArrayList<>(); List listOfSomething = new ArrayList(); - ArrayList arrayListOfSomething = null; + List arrayListOfSomething = null; List listOfNumber = null; - ArrayList arrayListOfNumber = null; + List arrayListOfNumber = null; ArrayList arrayListOfInteger = null; - ArrayList arrayListOfSomethingNumberish = null; + List arrayListOfSomethingNumberish = null; List listOfSomethingNumberish = new ArrayList(); List listOfSomethingSuperDouble = new ArrayList(); List listOfInteger = new ArrayList<>(); - ArrayList arrayList = null; + List arrayList = null; ArrayList arrayListOfString; ArrayList arraylistOfInteger; // interfaces too List @@ -477,18 +477,18 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable03_method_m4() { List list = new ArrayList(); - ArrayList arraylist = null; + List arraylist = null; List listOfString = new ArrayList<>(); List listOfSomething = new ArrayList(); - ArrayList arrayListOfSomething = null; + List arrayListOfSomething = null; List listOfNumber = null; - ArrayList arrayListOfNumber = null; - ArrayList arrayListOfSomethingNumberish = null; + List arrayListOfNumber = null; + List arrayListOfSomethingNumberish = null; List listOfSomethingNumberish = new ArrayList(); List listOfSomethingSuperDouble = new ArrayList(); List listOfInteger = new ArrayList<>(); - ArrayList arrayListOfString; - ArrayList arraylistOfInteger; + List arrayListOfString; + List arraylistOfInteger; // interfaces too List ReferenceType ajArrayListOfString = resolve("Pjava/util/ArrayList;"); -- 2.39.5