On Tue, 6 May 2025 15:37:02 GMT, Andy Goryachev <ango...@openjdk.org> wrote:
>> Why? > > so an array with the same values produces a different hash code. > in reality, it's highly unlikely. > > However, `FunctionExpression` is a `record`. What's the point of declaring > it a record when you override `hashCode` and `equals`? > Why? made me think. the reason is _probably_ so that `class B extends A` would produce a different `hashCode`, but then `A.hashCode` should include not the class instance, but the `getClass()`: class A { public int hashCode() { return Objects.hash(getClass(), ...); } } class B extends A { // B.hashCode() produces a value different from A.hashCode() } ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1655#discussion_r2075781903