diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 16:33:00 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 16:36:00 +0200 |
commit | 2409bcbc7c9606b055e23f52d688eecda84351d6 (patch) | |
tree | e775e9d0e033ec563236c31623f66d023c40aac5 /taskdefs/src | |
parent | 3641f1626df6b9b1c11dd3f16b01a01495f4662d (diff) | |
download | aspectj-2409bcbc7c9606b055e23f52d688eecda84351d6.tar.gz aspectj-2409bcbc7c9606b055e23f52d688eecda84351d6.zip |
Redundant Collection.addAll() call
Reports Collection.addAll() and Map.putAll() calls after instantiation of a collection using a constructor call without arguments. Such constructs can be replaced with a single call to a parametrized constructor which simplifies code. Also for some collections the replacement might be more performant.
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'taskdefs/src')
-rw-r--r-- | taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java | 3 | ||||
-rw-r--r-- | taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java | 3 |
2 files changed, 2 insertions, 4 deletions
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 83dcd9911..c6ebb14b3 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 @@ -1159,7 +1159,6 @@ public class AjcTask extends MatchingTask { // package-private for testing String[] makeCommand() { - ArrayList result = new ArrayList(); if (0 < ignored.size()) { for (Object o : ignored) { logVerbose("ignored: " + o); @@ -1182,7 +1181,7 @@ public class AjcTask extends MatchingTask { outjarFixedup = true; } - result.addAll(cmd.extractArguments()); + ArrayList result = new ArrayList(cmd.extractArguments()); addListArgs(result); String[] command = (String[]) result.toArray(new String[0]); diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java index 25128bb61..43125a862 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java @@ -53,8 +53,7 @@ public class Ajc extends DefaultCompilerAdapter { "-encoding", "-target" }); private static List<String> finalList(String[] args) { - List<String> result = new ArrayList<>(); - result.addAll(Arrays.asList(args)); + List<String> result = new ArrayList<>(Arrays.asList(args)); return Collections.unmodifiableList(result); } |