Skip to content

fix : ConfigObject.values() dropping entries with equal values - #877

Merged
johanandren merged 4 commits into
lightbend:mainfrom
souzataniya:agent/light-quiet-yano
Oct 6, 2026
Merged

johanandren merged 4 commits into
lightbend:mainfrom
souzataniya:agent/light-quiet-yano

Conversation

@souzataniya

Copy link
Copy Markdown
Contributor

values() used a HashSet, which dedups by value equality (origin/key ignored). So {a=1, b=1, c=2} returned only 2 values instead of 3, breaking the Map contract. Switched to ArrayList, added a regression test.

SimpleConfigObject#values() wrapped the backing map's values in a
HashSet. Since AbstractConfigValue#equals()/hashCode() intentionally
ignore origin and compare only type + unwrapped value, any two
entries whose values happened to be equal (e.g. a=1, b=1) silently
collapsed into one, breaking the java.util.Map contract that
values().size() == size().

Return a plain ArrayList instead, matching the semantics of
entrySet()/keySet(), and add a regression test covering duplicate
values.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lightbend-cla-validator

Copy link
Copy Markdown
Collaborator

Hi @souzataniya,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Akka Contributors License Agreement:

https://contribute.akka.io/contribute/cla

@souzataniya

souzataniya commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author

I have signed the CLA @lightbend-cla-validator

Comment thread config/src/main/java/com/typesafe/config/impl/SimpleConfigObject.java Outdated
Comment thread config/src/test/scala/com/typesafe/config/impl/ConfigValueTest.scala Outdated
@johanandren
johanandren merged commit 06a5271 into lightbend:main Oct 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants