On Fri, 30 Jul 2021 20:50:05 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:

> > I believe it was an optimisation to make comparison as quick as possible. 
> > There are many places in Swing where property keys are compared as object 
> > identity rather than using `equals`. If this place is changed, probably all 
> > other such places need updating if they haven't been updated to `equals` 
> > yet.
> 
> Probably it will be better to roll back this one, and carefully check the 
> usage of "==" for possible replacement by the "equal". That possibility 
> should be proved by some test cases.

It's the other way around: `equals` can always be used (but could be slower); 
however, `==` may produce incorrect results in some cases. Probably, such 
optimisation `==` vs `equals` doesn't make sense any more and we should replace 
all usages of `==` with `equals`.

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

PR: https://git.openjdk.java.net/jdk/pull/4943

Reply via email to