aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
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.matcher
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.matcher')
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java3
-rw-r--r--org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java3
2 files changed, 2 insertions, 4 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java
index c3f22b0b1..d380e988e 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java
@@ -293,8 +293,7 @@ public class CrosscuttingMembers {
theseShadowMungers.add(munger);
}
}
- Set<ShadowMunger> tempSet = new HashSet<>();
- tempSet.addAll(other.shadowMungers);
+ Set<ShadowMunger> tempSet = new HashSet<>(other.shadowMungers);
Set<ShadowMunger> otherShadowMungers = new HashSet<>();
Set<ShadowMunger> otherInlinedAroundMungers = new HashSet<>();
for (ShadowMunger munger : tempSet) {
diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java
index 9f524d836..f3609b7d7 100644
--- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java
+++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java
@@ -700,8 +700,7 @@ public class ParserTestCase extends PatternsTestCase {
WildAnnotationTypePattern watp = (WildAnnotationTypePattern) atp;
Map<String,String> m = watp.annotationValues;
Set<String> keys = m.keySet();
- List<String> orderedKeys = new ArrayList<>();
- orderedKeys.addAll(keys);
+ List<String> orderedKeys = new ArrayList<>(keys);
Collections.sort(orderedKeys);
StringBuffer sb = new StringBuffer();
for (Iterator<String> iterator = orderedKeys.iterator(); iterator.hasNext();) {