RFR: 8348936: [Accessibility,macOS,VoiceOver] VoiceOver doesn't announce untick on toggling the checkbox with "space" key on macOS [v2]

Abhishek Kumar abhiscxk at openjdk.org
Wed Feb 5 11:43:12 UTC 2025


On Wed, 5 Feb 2025 11:34:36 GMT, Alexey Ivanov <aivanov at openjdk.org> 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


More information about the client-libs-dev mailing list