RFR: 6726690: SwingUtilities.replaceUI*Map() methods do not remove previously installed maps [v3]

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Dec 9 00:36:21 UTC 2025


> `SwingUtilities.replaceUIInputMap()` and `SwingUtilities.replaceUIActionMap()` do not actually remove previously installed maps as their Javadoc indicates if `null` is passed as `uiInputMap`/`uiActionMap`
> 
> https://github.com/openjdk/jdk/blob/7e91d34f3e83b4c39d6ce5de34373d7d74d54512/src/java.desktop/share/classes/javax/swing/SwingUtilities.java#L1802-L1803
> https://github.com/openjdk/jdk/blob/7e91d34f3e83b4c39d6ce5de34373d7d74d54512/src/java.desktop/share/classes/javax/swing/SwingUtilities.java#L1827-L1828
> 
> If the passed  `uiInputMap`/`uiActionMap` is null, `JComponent` actually doesn't create a fresh map and returns the previously installed map 
> https://github.com/openjdk/jdk/blob/7e91d34f3e83b4c39d6ce5de34373d7d74d54512/src/java.desktop/share/classes/javax/swing/JComponent.java#L2586-L2595
> which is in contradiction to the `replaceUI*Map` spec so `SwingUtilities `needs to clear the previously installed map which is being done in this fix.

Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:

  Fix update...ActionMap test added

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28671/files
  - new: https://git.openjdk.org/jdk/pull/28671/files/847b6ba9..85028272

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28671&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28671&range=01-02

  Stats: 46 lines in 2 files changed: 34 ins; 10 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/28671.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28671/head:pull/28671

PR: https://git.openjdk.org/jdk/pull/28671


More information about the client-libs-dev mailing list