Commit 73926c93 authored by Aleksey Pivovarov's avatar Aleksey Pivovarov Committed by intellij-monorepo-bot
Browse files

IDEA-289528 platform: fix removing collection from property service

(cherry picked from commit 4e4803c43f81741e60918ba0faef82d834f2dee3)

GitOrigin-RevId: 0804de852481f99bd8adf0ebfa651cdbd7e7e958
parent 318287c2
Showing with 6 additions and 3 deletions
+6 -3
......@@ -36,7 +36,7 @@ public abstract class PropertiesComponent {
public abstract void setValue(@NonNls @NotNull String name, @NonNls @Nullable String value);
/**
* Set value or unset if equals to default value
* Set value or unset if equals to default value or null
*/
public abstract void setValue(@NonNls @NotNull String name, @NonNls @Nullable String value, @Nullable String defaultValue);
......
......@@ -49,6 +49,7 @@ sealed class BasePropertyService : PropertiesComponent(), PersistentStateCompone
override fun loadState(state: MyState) {
keyToString.clear()
keyToStringList.clear()
keyToString.putAll(state.keyToString)
keyToStringList.putAll(state.keyToStringList)
}
......@@ -112,7 +113,8 @@ sealed class BasePropertyService : PropertiesComponent(), PersistentStateCompone
override fun setValues(name: @NonNls String, values: Array<String>?) {
if (values == null) {
unsetValue(name)
keyToStringList.remove(name)
tracker.incModificationCount()
}
else {
keyToStringList.put(name, java.util.List.of(*values))
......@@ -124,7 +126,8 @@ sealed class BasePropertyService : PropertiesComponent(), PersistentStateCompone
override fun setList(name: String, values: MutableCollection<String>?) {
if (values == null) {
unsetValue(name)
keyToStringList.remove(name)
tracker.incModificationCount()
}
else {
// for possible backward compatibility to existing usages, allow to store empty collections
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment