dweiss commented on code in PR #15457:
URL: https://github.com/apache/lucene/pull/15457#discussion_r2578309600


##########
lucene/core/src/java/org/apache/lucene/index/FieldInfo.java:
##########
@@ -675,7 +674,7 @@ public synchronized String putAttribute(String key, String 
value) {
     String oldValue = newMap.put(key, value);
     // This needs to be thread-safe as multiple threads may be updating 
(different) attributes
     // concurrently due to concurrent merging.
-    attributes = Collections.unmodifiableMap(newMap);
+    attributes = Map.copyOf(newMap);

Review Comment:
   But a copyOf is going to be doing more copying, while unmodifiableMap is a 
thin wrapper. Is it possible for this code to be called a lot? If not, then the 
difference probably doesn't matter.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to