aboutsummaryrefslogtreecommitdiffstats
path: root/weaver/src
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-15 16:25:42 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-15 16:36:00 +0200
commit2debfa05f43a6fe71e7bc141f4f78c66f85c95b0 (patch)
tree0b536ac7ef2a5222c7382bc3d03f7023fb5c295d /weaver/src
parentd66bec041a857bc3076a20dfeb1aa6037b020db1 (diff)
downloadaspectj-2debfa05f43a6fe71e7bc141f4f78c66f85c95b0.tar.gz
aspectj-2debfa05f43a6fe71e7bc141f4f78c66f85c95b0.zip
Single Map method can be used
Reports common usage patterns of java.util.Map that could be replaced with Java 8 methods: getOrDefault(), computeIfAbsent(), putIfAbsent(), merge(), or replaceAll(). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'weaver/src')
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java6
1 files changed, 1 insertions, 5 deletions
diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java
index 1fb2812bb..62674dedf 100644
--- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java
@@ -167,11 +167,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
}
String tname = target.getName();
String pname = newParent.getName();
- List<String> newparents = declareParentsMap.get(tname);
- if (newparents == null) {
- newparents = new ArrayList<>();
- declareParentsMap.put(tname, newparents);
- }
+ List<String> newparents = declareParentsMap.computeIfAbsent(tname, k -> new ArrayList<>());
newparents.add(pname);
AsmRelationshipProvider.addRelationship(model, weaver.getLazyClassGen().getType(), munger, declaringAspect);
}