diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 17:01:46 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 17:01:46 +0200 |
commit | 639f5030e0391e831138f9786cf831c3374449e7 (patch) | |
tree | fc4e616cb6df8e73722a6d0cf83a55efd6d87387 /util | |
parent | 2409bcbc7c9606b055e23f52d688eecda84351d6 (diff) | |
download | aspectj-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 'util')
4 files changed, 10 insertions, 10 deletions
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<String> sink) { + public static String lineSeek(String sought, String sourcePath, boolean listAll, List<String> 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<String> result = new ArrayList<>(); + List<String> 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<Object> result = null; + List<Object> 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<T> list = new ArrayList<>(Arrays.asList(array)); + List<T> 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<File> dcopy = new ArrayList<>(); + List<File> dcopy = new ArrayList<>(); if (!LangUtil.isEmpty(dirs)) { dcopy.addAll(Arrays.asList(dirs)); diff --git a/util/src/test/java/org/aspectj/util/FileUtilTest.java b/util/src/test/java/org/aspectj/util/FileUtilTest.java index 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<String> sought = new ArrayList<>(LangUtil.arrayAsList(filenames)); + final List<String> 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<File> tempFiles; + final List<File> tempFiles; public FileUtilTest(String s) { super(s); @@ -388,7 +388,7 @@ public class FileUtilTest extends TestCase { } public void testRandomFileString() { - ArrayList<String> results = new ArrayList<>(); + List<String> 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<String> sourceList = new ArrayList<>(); sourceList.add(file.getPath()); - final ArrayList<String> errors = new ArrayList<>(); + final List<String> 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<String> errors = new ArrayList<>(); + final List<String> errors = new ArrayList<>(); final PrintStream errorSink = new PrintStream(System.err, true) { public void println(String error) { errors.add(error); |