On Thu, 26 Nov 2026 19:56:41 GMT, Alexander Zvegintsev <[email protected]> 
wrote:

> It looks like two `JList` paths are not covered, and can still clear 
> application key bindings:
> 
>     * Under Nimbus LaF, changing 
> [`Nimbus.Overrides`](https://download.java.net/java/early_access/genzgc/docs/api/java.desktop/javax/swing/plaf/nimbus/NimbusStyle.html)
>  reinstalls keyboard actions outside of `setUI()`. This clears the list’s 
> `WHEN_FOCUSED` bindings and its application actions.
> 
>     * `JList.writeObject()` calls `ui.installUI(this)` directly during 
> serialization. If `List.focusInputMap` is absent, `BasicListUI` can clear the 
> `WHEN_FOCUSED` bindings on the original list.

Yes, you are right..
For Nimbus, changing "Nimbus.Overrides" can cause `SynthListUI.updateStyle()` 
to call `uninstallKeyboardActions()`  and `installKeyboardActions()` directly, 
so it never enters SwingUtilities2 helpers so `isChangingUI()` returns false so 
removal calls clears the application maps.
For serialization, JList has its own private `writeObject()` so changing 
`JComponent.writeObject()` does not affect this call. When 
`JList.writeObject()` reinstalls the UI, our context is absent. If 
`List.focusInputMap` is absent, `BasicListUI.installKeyboardActions()` passes 
null, triggering clearing on the original list being serialized.

FIx is made to route this 2 flows through SwingUtilities2. A separate 
regression test is also added to check this missing paths.

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

PR Comment: https://git.openjdk.org/jdk/pull/34034#issuecomment-7218157636

Reply via email to