uschindler commented on PR #14074:
URL: https://github.com/apache/lucene/pull/14074#issuecomment-2548460187

   P.S.: I added the `Collections.immutableCollection` only in the getter, 
because making `EnumMap clauseSets` does not work:
   - The inner values of the map are custom classes. As we have no unmodifiable 
Multiset, we cant wrap it without breaking equals (If we map it as 
unmodifiableCollection, the resulting equals/hashCode inspects all elements and 
respects order.
   - we can make the outer map immutable, but as this one is not exposed, I 
don't care. I just added another warning.
   
   For the future: If people submit PRs about making private members which are 
collections public, always check if the immutability could be violated. This is 
a major problem in Java where collections are by default mutable!


-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to