<i18n dev> RFR: 8357224: Avoid redundant WeakHashMap.get in Toolkit.removeAWTEventListener
Alexey Ivanov
aivanov at openjdk.org
Tue May 20 20:08:52 UTC 2025
On Tue, 20 May 2025 18:59:33 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> 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.
You're right!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24692#discussion_r2098766802
More information about the i18n-dev
mailing list