On Mon, 25 Nov 2024 16:07:41 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:

>> Good point, I never ever did that for `Node`s (and I don't know why I would 
>> need to), but you are right, it is indeed possible and therefore a possible 
>> scenario.
>
> I think this is overly cautious.  Overriding equals on a class that did not 
> implement equals in a hierarchy you don't control  is not a very reasonable 
> scenario.  You will not be able to call `super.equals` with reasonable 
> results if the hierarchy did not implement it in the first place.  This is 
> because there may be private data that you can't access for your equality 
> comparison (and `Node` has lots of that).  We also use `WeakHashMap`s in 
> several areas already with subtypes of `Node`s as keys (I found `Region`, 
> `Parent` and `TreeView` being used as keys), so this kind of override should 
> probably be documented as being unsupported on `Node`.
> 
> Perhaps it should even be made final so FX internals can rely on it being 
> correct.

Makes sense. I think we should make `Node.equals()` final in this case.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1607#discussion_r1857061762

Reply via email to