RFR: 8308588: Unnecessary synchronized on GTKStyle#ICONS_MAP can be removed [v2]
Abhishek Kumar
abhiscxk at openjdk.org
Fri Aug 30 04:57:56 UTC 2024
> `static final Map<String,GTKStockIcon> ICONS_MAP` is modified only in `static` block. Then [com.sun.java.swing.plaf.gtk.GTKStyle#get](https://github.com/kumarabhi006/jdk/blob/73f7a5f15dbba54a98f3916ff1190520ac07874d/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java#L892) method read from it within `synchronized (ICONS_MAP)` block. As this map is read-only and all its content is initialized in static block we can safely remove synchronized from get call.
Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
Use Collections.unmodifiableMap and remove blank line
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/20741/files
- new: https://git.openjdk.org/jdk/pull/20741/files/5775df65..af1fdbdc
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=20741&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=20741&range=00-01
Stats: 17 lines in 1 file changed: 1 ins; 1 del; 15 mod
Patch: https://git.openjdk.org/jdk/pull/20741.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/20741/head:pull/20741
PR: https://git.openjdk.org/jdk/pull/20741
More information about the client-libs-dev
mailing list