On Fri, 23 Jan 2026 13:34:27 GMT, Alexey Ivanov <[email protected]> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> 8376169
>
> src/java.desktop/share/classes/javax/swing/JPopupMenu.java line 957:
>
>> 955: if (invoker != null) {
>> 956: Component oldInvoker = this.invoker;
>> 957: this.invoker = invoker;
>
> This doesn't look right to me. Is `this.invoker == null` an invalid state?
>
> I believe the only thing that requires to be guarded by `if (invoker !=
> null)` is `invoker.addPropertyChangeListener`; maybe `ui.installUI(this)`,
> however, I can't see why the latter should be skipped in cases where
> `invoker` is `null`.
I'm also not sure it is right. It changes from an NPE to a no-op.
Before the previous fix as well as with the current code, null will at least do
uninstallUI()
And because of this bug report it seems people expect null to be valid and
presumably do something.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29377#discussion_r2722369832