aboutsummaryrefslogtreecommitdiffstats
path: root/util/src
diff options
context:
space:
mode:
Diffstat (limited to 'util/src')
-rw-r--r--util/src/main/java/org/aspectj/util/FileUtil.java4
-rw-r--r--util/src/main/java/org/aspectj/util/LangUtil.java7
-rw-r--r--util/src/main/java/org/aspectj/util/UtilClassLoader.java2
-rw-r--r--util/src/test/java/org/aspectj/util/FileUtilTest.java13
4 files changed, 12 insertions, 14 deletions
diff --git a/util/src/main/java/org/aspectj/util/FileUtil.java b/util/src/main/java/org/aspectj/util/FileUtil.java
index 7fd48936f..588a46c43 100644
--- a/util/src/main/java/org/aspectj/util/FileUtil.java
+++ b/util/src/main/java/org/aspectj/util/FileUtil.java
@@ -709,7 +709,7 @@ public class FileUtil {
if ((null != srcDir) && srcDir.canRead()) {
listFiles(srcDir, result, fileFilter);
}
- return result.toArray(new File[result.size()]);
+ return result.toArray(new File[0]);
}
/**
@@ -1293,7 +1293,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 98f53e3c8..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,8 +1000,7 @@ public class LangUtil {
if ((null == array) || (1 > array.length)) {
return Collections.emptyList();
}
- ArrayList<T> list = new ArrayList<>();
- list.addAll(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 4ecbc3371..2c488bc3a 100644
--- a/util/src/main/java/org/aspectj/util/UtilClassLoader.java
+++ b/util/src/main/java/org/aspectj/util/UtilClassLoader.java
@@ -39,7 +39,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 7936914fb..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,14 +502,13 @@ 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);
}
};
- List<String> sourceList = new ArrayList<>();
- sourceList.addAll(Arrays.asList(sources));
+ List<String> sourceList = new ArrayList<>(Arrays.asList(sources));
sourceList = Collections.unmodifiableList(sourceList);
for (int k = 0; k < sources.length; k++) {
List<String> result = FileUtil.lineSeek("" + k, sourceList, true, errorSink);