LuciferYang opened a new pull request, #13414:
URL: https://github.com/apache/gravitino/pull/13414

   ### What changes were proposed in this pull request?
   
   `RoleEntity.hashCode` now combines an order-independent sum of element 
hashes for `securableObjects` with the scalar fields, matching exactly what 
`equals` compares.
   
   ### Why are the changes needed?
   
   `equals` compares `securableObjects` order-independently via 
`CollectionUtils.isEqualCollection`, but `hashCode` hashed the `List` directly, 
so two equal roles with different securable-object ordering hashed differently, 
breaking the `Object.hashCode` contract for any hash-based collection.
   
   Fix: #13413
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added `TestRoleEntity.testHashCodeConsistentWithBagEquality`, which pins 
that two roles equal under unordered securable objects share a hash code. It 
fails against the pre-fix code.
   


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