RFR: 8376169: JPopupMenu.setInvoker(null) causes NPE [v3]
Alexey Ivanov
aivanov at openjdk.org
Tue Jan 27 13:24:52 UTC 2026
On Tue, 27 Jan 2026 09:49:32 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> Invoking `JPopupMenu.setInvoker(null)` causes NPE which is fixed in this PR
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> Invoker null check
Now the fix looks good except for a couple of comments that I'd like to get an answer before I approve the PR.
src/java.desktop/share/classes/javax/swing/JPopupMenu.java line 970:
> 968: invalidate();
> 969:
> 970: }
Does this newly added blank line right before the closing brace of the method serve any purpose? I'd rather not add it.
test/jdk/javax/swing/JPopupMenu/TestPopupInvoker.java line 76:
> 74: public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
> 75: popupHidden.countDown();
> 76: popupMenu.setInvoker(null);
You may add an assert that `popupMenu.getInvoker()` returns `null`.
-------------
PR Review: https://git.openjdk.org/jdk/pull/29377#pullrequestreview-3711145159
PR Review Comment: https://git.openjdk.org/jdk/pull/29377#discussion_r2731967143
PR Review Comment: https://git.openjdk.org/jdk/pull/29377#discussion_r2731979046
More information about the client-libs-dev
mailing list