LuciferYang opened a new issue, #13232: URL: https://github.com/apache/gravitino/issues/13232
**Version** main branch **Describe what's wrong** The `Distribution` interface defines `default boolean equals(Distribution)`, which overloads (never overrides) `Object.equals`. `HashSet`/`HashMap` and any comparison through an `Object` reference use identity semantics, while `a.equals(b)` with both sides statically typed as `Distribution` binds to the overload with structural cross-representation semantics, so the same two objects can compare differently depending on the static type, and implementations relying on the default get identity equality in collections. **Error message and/or stacktrace** N/A: inconsistent `equals` behavior, no exception. **How to reproduce** With two structurally-equal `Distribution` values, compare them once through `Object` references (or via a `HashSet`) and once with both statically typed as `Distribution`; the two comparisons can disagree. **Additional context** All in-repo implementations already override `equals(Object)`/`hashCode`. The overload also served a cross-representation NONE check at eleven call sites. Found during a code audit of the `api` module. -- 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]
