-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
architectureDifficult architectural questionsDifficult architectural questions
Milestone
Description
I think it makes sense to have default values of list properties, set properties and similar immutable, but it's a bit cumbersome to have to work around the current value being immutable whenever we want to add or remove a value. It might make sense to just always hold the default value as mutable (i.e. by copying the default value over into an ArrayList
or similar when it's not in the resource), or by providing a method that redefines the list to be mutable if needed (for ListProperty
):
public List<E> getOrInitAsMutableList(@NotNull SettingsManager settingsManager) {
List<E> value = settingsManager.getProperty(this);
if (value.getClass() != ArrayList.class) {
value = new ArrayList<>(value);
settingsManager.setProperty(this, value);
}
return value;
}
I think ideally we have the default value immutable, the current value always mutable. I don't think the performance impact of copying over entries should be noticeable.
Metadata
Metadata
Assignees
Labels
architectureDifficult architectural questionsDifficult architectural questions