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 /ajde.core/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 'ajde.core/src')
-rw-r--r-- | ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java | 3 | ||||
-rw-r--r-- | ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java | 3 |
2 files changed, 2 insertions, 4 deletions
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 a8b82ce7f..7aec20809 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 @@ -225,8 +225,7 @@ public class AjdeCoreBuildManager { if (projectSourceFiles == null) { return null; } - List<String> l = new ArrayList<>(); - l.addAll(projectSourceFiles); + List<String> l = new ArrayList<>(projectSourceFiles); // If the processor options are specified build the command line options for the JDT compiler to see String processor = compilerConfig.getProcessor(); if (processor != null && processor.length() != 0) { diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java index c5fa43e16..13597f14f 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java @@ -367,8 +367,7 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { String line = null; while ((line = fr.readLine()) != null) fileContents.add(line); - List<String> originalFileContents = new ArrayList<>(); - originalFileContents.addAll(fileContents); + List<String> originalFileContents = new ArrayList<>(fileContents); // See if the messages match int msgCount = 0; |