sosy-lab / java-common-lib

SoSy-Lab Java Common Library
https://www.sosy-lab.org
Apache License 2.0
12 stars 11 forks source link

Bug: NoSuchElementException when calling containsAll() in PathCopyingPersistentTreeMap.entrySet() #19

Closed kfriedberger closed 6 years ago

kfriedberger commented 6 years ago

I am using sosy-common-lib in version 0.3000-256-gd9a00de, which is currently used in CPAchecker.

The following snippet throws an exception:

PersistentMap<String, Integer> first = PathCopyingPersistentTreeMap.of(); first = first.putAndCopy("c", 3).putAndCopy("d", 4); PersistentMap<String, Integer> second = PathCopyingPersistentTreeMap.of(); second = second.putAndCopy("b", 2).putAndCopy("c", 3); if (second.entrySet().containsAll(first.entrySet())) { }

Stacktrace:

Exception in thread "main" java.util.NoSuchElementException at java.util.ArrayDeque.removeFirst(ArrayDeque.java:285) at java.util.ArrayDeque.pop(ArrayDeque.java:522) at org.sosy_lab.common.collect.PathCopyingPersistentTreeMap$EntryInOrderIterator.next(PathCopyingPersistentTreeMap.java:1058) at org.sosy_lab.common.collect.PathCopyingPersistentTreeMap$EntryInOrderIterator.next(PathCopyingPersistentTreeMap.java:952) at org.sosy_lab.common.collect.Collections3.sortedSetContainsAll(Collections3.java:259) at org.sosy_lab.common.collect.SortedMapEntrySet.containsAll(SortedMapEntrySet.java:96) ...

Please fix this bug!

Update/Edit: snippet simplified.