diff --git a/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java b/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java index f65a4e38deb0..9e1276abdf11 100644 --- a/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java +++ b/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java @@ -79,8 +79,8 @@ public BytesRefHash(ByteBlockPool pool, int capacity, BytesStartArray bytesStart Arrays.fill(ids, -1); this.bytesStartArray = bytesStartArray; bytesStart = bytesStartArray.init(); - bytesUsed = - bytesStartArray.bytesUsed() == null ? Counter.newCounter() : bytesStartArray.bytesUsed(); + final Counter bytesUsed = bytesStartArray.bytesUsed(); + this.bytesUsed = bytesUsed == null ? Counter.newCounter() : bytesUsed; bytesUsed.addAndGet(hashSize * (long) Integer.BYTES); }