aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-15 17:01:46 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-15 17:01:46 +0200
commit639f5030e0391e831138f9786cf831c3374449e7 (patch)
treefc4e616cb6df8e73722a6d0cf83a55efd6d87387 /org.aspectj.ajdt.core
parent2409bcbc7c9606b055e23f52d688eecda84351d6 (diff)
downloadaspectj-639f5030e0391e831138f9786cf831c3374449e7.tar.gz
aspectj-639f5030e0391e831138f9786cf831c3374449e7.zip
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 <eclipse@larsgrefer.de>
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java2
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java2
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java4
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java3
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java8
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/ASTVisitorTest.java2
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java2
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/MainTest.java3
8 files changed, 14 insertions, 12 deletions
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<Arg> args, String arg) {
+ private int indexOf(Iterable<Arg> 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<String> classpath = new ArrayList<>();
private List<String> modulepath = new ArrayList<>();
// Expensive to compute (searching modules, parsing module-info)
- private ArrayList<Classpath> modulepathClasspathEntries = null;
+ private Collection<Classpath> modulepathClasspathEntries = null;
private List<String> modulesourcepath = new ArrayList<>();
// Expensive to compute (searching modules, parsing module-info)
- private ArrayList<Classpath> modulesourcepathClasspathEntries = null;
+ private Collection<Classpath> modulesourcepathClasspathEntries = null;
private Classpath[] checkedClasspaths = null;
private List<String> bootclasspath = new ArrayList<>();
private List<String> 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<File> files = new ArrayList<>();
+ final List<File> 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<String> normalizeFilenames(String[] ra) { // XXX util
- ArrayList<String> result = new ArrayList<>();
+ List<String> 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<String> normalizeFilenames(List<File> list) { // XXX util
- ArrayList<String> result = new ArrayList<>();
+ List<String> 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<String,String> options = new HashMap<>();
+ Map<String,String> options = new HashMap<>();
options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
parser.setCompilerOptions(options);
parser.setSource(source.toCharArray());
diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/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 List<String >tokenizeCommand(String command) {
StringTokenizer st = new StringTokenizer(command," ", false);
- ArrayList<String> arguments = new ArrayList<>();
+ List<String> 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<String> list = new ArrayList<>();
+ List<String> list = new ArrayList<>();
// Usage now printed by Eclipse compiler so doesn't appear here in our message list
// Main.bareMain(new String[] {"-help"}, false, list, null, null, null);
// assertTrue(1 == list.size());