Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentModificationException when using replaceAll() on PersistentMap.builder() #68

Closed
Virtlink opened this issue Jan 21, 2020 · 2 comments
Assignees
Labels

Comments

@Virtlink
Copy link

Calling replaceAll() on the mutable builder of a PersistentMap throws a ConcurrentModificationException.

Reproduction

To reproduce:

val pmap = persistentMapOf("a" to 1, "b" to 2)
val mmap = pmap.builder()
mmap.replaceAll { _, u -> u + 1 }	// throws ConcurrentModificationException
mmap.build()

What I expected

A persistent map with the mapping "a" to 2, "b" to 3.

What I got

An exception:

java.util.ConcurrentModificationException
	at kotlinx.collections.immutable.implementations.persistentOrderedMap.PersistentOrderedMapBuilderLinksIterator.checkForComodification(PersistentOrderedMapBuilderContentIterators.kt:57)
	at kotlinx.collections.immutable.implementations.persistentOrderedMap.PersistentOrderedMapBuilderLinksIterator.next(PersistentOrderedMapBuilderContentIterators.kt:26)
	at kotlinx.collections.immutable.implementations.persistentOrderedMap.PersistentOrderedMapBuilderEntriesIterator.next(PersistentOrderedMapBuilderContentIterators.kt:69)
	at kotlinx.collections.immutable.implementations.persistentOrderedMap.PersistentOrderedMapBuilderEntriesIterator.next(PersistentOrderedMapBuilderContentIterators.kt:61)
	at java.util.Map.replaceAll(Map.java:675)
@qurbonzoda qurbonzoda self-assigned this Mar 20, 2020
@qurbonzoda qurbonzoda added the bug label Mar 27, 2020
@qurbonzoda
Copy link
Contributor

This issue was fixed in 0.3.2 version of the library.
Thank you for reporting this bug!

@Virtlink
Copy link
Author

This issue is not fixed. The above code still throws a ConcurrentModificationException in version 0.3.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants