From 4c20079b2b3503142f05eb461ccafe4d341e6b5a Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 2 Apr 2024 08:27:03 +0300 Subject: [PATCH] IDEA-350081 Impossible to restore toolbar defaults if there was an action with custom icon GitOrigin-RevId: 37b460a710bbd1ffdd790d67bbb9200f35808360 --- .../intellij/ide/ui/customization/CustomActionsSchema.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.kt b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.kt index c48908a405f7..e3533f3d0306 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.kt +++ b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.kt @@ -65,8 +65,9 @@ class CustomActionsSchema(private val coroutineScope: CoroutineScope?) : Persist * * path to the SVG or PNG file of the icon * * URL of the SVG or PNG icon */ + // do not use Map.of - value is nullable @Volatile - private var iconCustomizations: Map = java.util.Map.of() + private var iconCustomizations: Map = Collections.emptyMap() private val lock = Any() // ordered map, do not use hash map @@ -182,7 +183,7 @@ class CustomActionsSchema(private val coroutineScope: CoroutineScope?) : Persist for (id in ids) { iconCustomizations.putIfAbsent(id, null) } - this.iconCustomizations = java.util.Map.copyOf(iconCustomizations) + this.iconCustomizations = Collections.unmodifiableMap(iconCustomizations) } } @@ -244,7 +245,7 @@ class CustomActionsSchema(private val coroutineScope: CoroutineScope?) : Persist isFirstLoadState = false } - this.iconCustomizations = java.util.Map.copyOf(iconCustomizations) + this.iconCustomizations = Collections.unmodifiableMap(iconCustomizations) } coroutineScope?.launch { if (!iconCustomizations.isEmpty()) {