On Tue, 9 Dec 2025 09:03:09 GMT, Alexander Zvegintsev <[email protected]> 
wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Fix update...ActionMap test added
>
> src/java.desktop/share/classes/javax/swing/SwingUtilities.java line 1839:
> 
>> 1837:     public static void replaceUIActionMap(JComponent component,
>> 1838:                                           ActionMap uiActionMap) {
>> 1839:         ActionMap map = component.getActionMap((uiActionMap != null));
> 
> Another approach would be to nullify the map.
> In this case we don't modify the previously stored map. If a user stores a 
> link to it, they can reuse it later. 
> 
> Suggestion:
> 
> if (uiActionMap == null) {
>     component.setActionMap(null);
>     return;
> }
> 
> ActionMap map = component.getActionMap(true);
> 
> However, this will also require updating the JComponent code to reset the 
> flags.
> 
> https://github.com/openjdk/jdk/blob/cba09cd10d4e4482852a317786242836419c313b/src/java.desktop/share/classes/javax/swing/JComponent.java#L2524-L2527
> 
> 
> It may be worth considering this option.

I had tried with nullify by using setInputMap(null) initially but there was 
some CI issue with some tests with that approach so I followed this and with 
this, the fix is contained in this class.

.JComponent's flag set/reset method is private so any change there possibly 
would have needed CSR so I guess this is good for this issue..

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28671#discussion_r2601937606

Reply via email to