Skip to content

Invalidate ordered map builder after entry value updates#253

Open
odenix wants to merge 1 commit into
Kotlin:masterfrom
odenix:fix-ordered-map-builder-entry-set-value-cache
Open

Invalidate ordered map builder after entry value updates#253
odenix wants to merge 1 commit into
Kotlin:masterfrom
odenix:fix-ordered-map-builder-entry-set-value-cache

Conversation

@odenix
Copy link
Copy Markdown

@odenix odenix commented Apr 25, 2026

This bug was found and fixed by Codex.

PersistentOrderedMapBuilder caches the last built ordered map. Updating an entry through MutableMap.MutableEntry.setValue updated only the backing hash map builder, leaving the ordered builder cache incorrectly valid. A later build() could therefore return the previously built map.

Route entry value updates through the ordered map builder so its existing cache invalidation path runs. Add a regression test that builds once before mutating an entry value.

This bug was found and fixed by Codex.

PersistentOrderedMapBuilder caches the last built ordered map.
Updating an entry through MutableMap.MutableEntry.setValue updated only the backing hash map builder,
leaving the ordered builder cache incorrectly valid.
A later build() could therefore return the previously built map.

Route entry value updates through the ordered map builder so its existing cache invalidation path runs.
Add a regression test that builds once before mutating an entry value.
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.

1 participant