RFR: 8286663: Resolve IDE warnings in WTrayIconPeer and SystemTray [v3]

Phil Race prr at openjdk.java.net
Wed Jun 1 17:52:34 UTC 2022


On Fri, 27 May 2022 20:48:30 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> **WTrayIconPeer**: removed duplicate call to `popupParent.dispose()` that might cause NPE (it looks `popupParent` cannot be `null`); organised imports.
>> 
>> **SystemTray**: removed redundant initialisers; replaced sized array with empty array in `toArray` call; dropped `newValue != null` chained with `equals`.
>
> Alexey Ivanov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use method reference in setSystemTrayAccessor instead of anonymous class

Marked as reviewed by prr (Reviewer).

> If method reference is used, the code becomes much shorter:
> 
> ```java
>         AWTAccessor.setSystemTrayAccessor(SystemTray::firePropertyChange);
> ```
> 
> What do others think?

I am sure this code pre-dates method references, but if updating something then using method references is perfectly OK.

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

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



More information about the client-libs-dev mailing list