aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-15 16:33:00 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-15 16:36:00 +0200
commit2409bcbc7c9606b055e23f52d688eecda84351d6 (patch)
treee775e9d0e033ec563236c31623f66d023c40aac5 /org.aspectj.ajdt.core
parent3641f1626df6b9b1c11dd3f16b01a01495f4662d (diff)
downloadaspectj-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 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java3
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java3
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java3
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java3
4 files changed, 4 insertions, 8 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 a68698697..c309a3a5a 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
@@ -152,8 +152,7 @@ public class BuildArgParser extends Main {
boolean incrementalMode = buildConfig.isIncrementalMode() || buildConfig.isIncrementalFileMode();
- List<File> xmlfileList = new ArrayList<>();
- xmlfileList.addAll(parser.getXmlFiles());
+ List<File> xmlfileList = new ArrayList<>(parser.getXmlFiles());
List<File> fileList = new ArrayList<>();
List<File> files = parser.getFiles();
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
index 809a73af8..beea71dc9 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
@@ -250,8 +250,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
Collections.addAll(typesToProcess, stbs);
}
- List<SourceTypeBinding> stb2 = new ArrayList<>();
- stb2.addAll(typesToProcess);
+ List<SourceTypeBinding> stb2 = new ArrayList<>(typesToProcess);
while (typesToProcess.size() > 0) {
// A side effect of weaveIntertypes() is that the processed type is removed from the collection
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 cfda72357..4fb176e88 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
@@ -377,8 +377,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags {
* classpath), and output dir or jar
*/
public List<String> getFullClasspath() {
- List<String> full = new ArrayList<>();
- full.addAll(getBootclasspath()); // XXX Is it OK that boot classpath overrides inpath/injars/aspectpath?
+ List<String> full = new ArrayList<>(getBootclasspath()); // XXX Is it OK that boot classpath overrides inpath/injars/aspectpath?
for (File file: inJars) {
full.add(file.getAbsolutePath());
}
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 355267b0f..09ecdb34b 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
@@ -121,8 +121,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests?
List safeFiles = Collections.unmodifiableList(files);
log("Compiling ", safeFiles, handler);
if (1 == i) {
- ArrayList<String> argList = new ArrayList<>();
- argList.addAll(getBaseArgs(targetSrc, targetClasses));
+ ArrayList<String> argList = new ArrayList<>(getBaseArgs(targetSrc, targetClasses));
File[] fra = (File[]) safeFiles.toArray(new File[0]);
// sigh
argList.addAll(