RFR: 8322239: [macos] a11y : java.lang.NullPointerException is thrown when focus is moved on the JTabbedPane [v4]

Alexey Ivanov aivanov at openjdk.org
Thu Feb 15 17:59:54 UTC 2024


On Thu, 15 Feb 2024 17:43:03 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

>> test/jdk/javax/swing/JTabbedPane/TabbedPaneNPECheck.java line 90:
>> 
>>> 88:             if (accessible instanceof AccessibleComponent) {
>>> 89:                 try {
>>> 90:                     AccessibleComponent component = (AccessibleComponent) accessible;
>> 
>> You can you pattern matching if you like:
>> Suggestion:
>> 
>>             if (accessible instanceof AccessibleComponent component) {
>>                 try {
>
> Since this fix can be backported to the previous releases where this nice feature is not available i prefer not to use it. I guess backporting is why we can't get nice things for ourselves.

Yeah, it's a consideration. Pattern matching for `instanceof` is available since Java 16, so only 11 and below will need slight modification.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17736#discussion_r1491407399


More information about the client-libs-dev mailing list