<i18n dev> RFR: 8357224: Avoid redundant WeakHashMap.get in Toolkit.removeAWTEventListener
Sergey Bylokhov
serb at openjdk.org
Tue May 20 19:01:55 UTC 2025
On Mon, 19 May 2025 12:23:27 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Looks like yes. I think it's worth to create a separate issue to fix it.
>
> It doesn't matter, it looks… `localL` is `null` if and only if listener is `null`.
>
> However, I'd put the null-check above the call to `deProxyAWTEventListener` to avoid any confusion.
listener and proxy are public classes and there's no assertion that EventListenerProxy.getListener() will always return a non-null value. So this method should fetch the listener from the proxy and check it for null similar to how it is implemented in addAWTEventListener. Currently, it works fine because we never insert null values into the map. so it is just a code clarification.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24692#discussion_r2098669264
More information about the i18n-dev
mailing list