LuciferYang opened a new issue, #13409:
URL: https://github.com/apache/gravitino/issues/13409

   **What would you like to be improved?**
   
   `UserEntity.equals` compares `roleNames` and `roleIds` with 
`CollectionUtils.isEqualCollection` (order-independent, bag semantics), but 
`hashCode` hashes those `List`s directly, which is order-sensitive. Two users 
that are equal under `equals` but differ only in role ordering get different 
hash codes, which violates the `Object.hashCode` contract and loses them in any 
`HashSet` or `HashMap`.
   
   **How should we improve?**
   
   Combine an order-independent sum of element hashes for `roleNames` and 
`roleIds` into `hashCode`, matching exactly the fields `equals` compares. This 
also folds in `namespace`, which `equals` already compares but the old 
`hashCode` omitted.
   


-- 
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]

Reply via email to