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

   ### What changes were proposed in this pull request?
   
   `RemoveMetadataObject.equals` now casts to `RemoveMetadataObject`, compares 
both `metadataObject` and `locations`, and includes `locations` in `hashCode` 
to preserve the `equals`/`hashCode` contract.
   
   ### Why are the changes needed?
   
   After the `getClass()` guard the argument was cast to the sibling 
`RenameMetadataObject`, so comparing two `RemoveMetadataObject` instances 
(including `HashSet`/`contains`) always threw `ClassCastException`, and 
`locations` was ignored.
   
   Fix: #13216
   
   ### Does this PR introduce _any_ user-facing change?
   
   No API change. Comparing two `RemoveMetadataObject` instances no longer 
throws `ClassCastException`, and `equals`/`hashCode` now take `locations` into 
account.
   
   ### How was this patch tested?
   
   Added `TestMetadataObjectChange`, which pins `equals`/`hashCode` for 
`RemoveMetadataObject` (comparing two instances, and `HashSet` membership); it 
fails on the pre-fix tree with `ClassCastException` and passes after the fix.
   


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