config icon indicating copy to clipboard operation
config copied to clipboard

ConfigObject is not immutable - can mutate through keySet()

Open A248 opened this issue 6 months ago • 0 comments

Despite the documentation, ConfigObject can be mutated. The key set of a map supports removal operations. This happens because of the following factors.

  1. A library user calls ConfigValueFactory.fromMap.
  2. ConfigImpl#fromAnyRef constructs SimpleConfigObject using new SimpleConfigObject(origin, values) where values is a HashMap.
  3. SimpleConfigObject's keySet() method returns a mutable Set<String>. This Set cannot be added to, but it supports element removal.

A248 avatar Jun 09 '25 08:06 A248