On Wed, 5 Feb 2025 11:34:36 GMT, Alexey Ivanov <[email protected]> wrote:
>> src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java line 186:
>>
>>> 184: if (thisRole == AccessibleRole.CHECK_BOX) {
>>> 185: if ((newValue != null &&
>>> !newValue.equals(oldValue)) ||
>>> 186: oldValue != null &&
>>> !oldValue.equals(newValue)) {
>>
>> At first glance, these conditions look like the same thing. equals() above
>> will return false if oldValue is null. oldValue.equals(newValue) and
>> newValue.equals(oldValue) are also the same thing. Try to rewrite this
>> condition more clearly.
>
> I think @savoptik meant that `!oldValue.equals(newValue)` was redundant.
Yes,` oldValue.equals(newValue)` or `newValue.equals(oldValue)` always return
same value. But when `newValue` was null, I couldn't use
`newValue.equals(oldValue)` as it throws NPE. Anyway, the condition is
simplified now.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23436#discussion_r1942715423