Apache Lucene open-source search software
LUCENE-6076: Remove unnecessary copy (thanks Robert for pointing this out).
Adrien Granda03adb85ea89
diff --git a/lucene/core/src/java/org/apache/lucene/search/CachingWrapperFilter.java b/lucene/core/src/java/org/apache/lucene/search/CachingWrapperFilter.javaindex 2e728b0b5a0..edb9400b1c5 100644--- a/lucene/core/src/java/org/apache/lucene/search/CachingWrapperFilter.java+++ b/lucene/core/src/java/org/apache/lucene/search/CachingWrapperFilter.java@@ -149,10 +149,9 @@ public class CachingWrapperFilter extends Filter implements Accountable {@Overridepublic Iterable<? extends Accountable> getChildResources() {// Sync to pull the current set of values:- final Map<Object, DocIdSet> copy;synchronized (cache) {- copy = new HashMap<>(cache);+ // no need to clone, Accountable#namedAccountables already copies the data+ return Accountables.namedAccountables("segment", cache);}- return Accountables.namedAccountables("segment", copy);}}