RFR: 8286663: Resolve IDE warnings in WTrayIconPeer and SystemTray

Alexey Ivanov aivanov at openjdk.java.net
Mon May 23 20:31:42 UTC 2022


On Mon, 23 May 2022 20:24:52 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> ok ... why ?
>
> It's explained in Aleksey Shipilёv's article
> https://shipilev.net/blog/2016/arrays-wisdom-ancients/#_conclusion

In fact, there's no need to create zero-sized array, there's one already: `EMPTY_TRAY_ARRAY`.

Yet the code may look weird with it.


return icons.toArray(EMPTY_TRAY_ARRAY);

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

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



More information about the client-libs-dev mailing list