On Sun, 25 Sep 2022 06:21:43 GMT, ExE Boss <d...@openjdk.org> wrote:

>> Some also had two separate methods to check equality, one calling the other. 
>> Objects.equals() is used in some places as a replacement for a local copy of 
>> the function. In the end, the equals methods become quicker to understand 
>> their checks, more condensed, and becomes more in line with other equality 
>> methods in the JDK.
>
> Maybe keep the old variable names:

@ExE-Boss are you in the JBS? If you are, would you please add a bug report for 
this PR?

> src/java.desktop/share/classes/sun/font/PhysicalFont.java line 45:
> 
>> 43: 
>> 44:     public boolean equals(Object o) {
>> 45:         return o instanceof PhysicalFont other
> 
> The old implementation also checked that the runtime class of `other` is the 
> same as that of `this`:
> Suggestion:
> 
>         return o instanceof PhysicalFont other
>                 && other.getClass() == this.getClass()

Intentional change. There is only one class that extends PhysicalFont, which 
also happens to overrides PhysicalFont's equals. So checking via instanceof 
shouldn't mean any change. Also I think I forgot to add a `o == this ||` to 
some of them... Tomorrow's problem.

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

PR: https://git.openjdk.org/jdk/pull/10416

Reply via email to