RFR: 4938801: The popup does not go when the component is removed [v6]

Jeremy Wood duke at openjdk.org
Wed Jul 30 05:34:55 UTC 2025


On Wed, 30 Jul 2025 05:12:12 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> You can serialize a lambda expression if its target type and its captured arguments are serializable

I think that means `propListener` is NOT going to serialize, because `PropertyChangeListener` isn't `Serializable`. I'm unfamiliar with these details; I found this link helpful: https://www.baeldung.com/java-serialize-lambda

Alternatively: if we put `propListener` in BasicPopupMenuUI: then I think serialization will be less of an issue. `JComponent#ui` is transient, so we don't try to serialize it (and all of its other listeners). This way the JPopupMenu will come out on the other side of deserialization using whatever the L&F is in that setup. This feels good-ish to me.

(I'm assuming most L&F's extend BasicPopupMenuUI?)

This is all just an idea/suggestion; as long as the deserialized JPopupMenu behaves like the original JPopupMenu I think that should be fine.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26407#discussion_r2241571712


More information about the client-libs-dev mailing list