This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git


The following commit(s) were added to refs/heads/master by this push:
     new b2412b2b3 Fix stale size in AbstractMapMultiSet view iterator remove 
(#701).
b2412b2b3 is described below

commit b2412b2b30968b6ec323b78e06928115c68bb44a
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Jul 3 18:08:53 2026 +0000

    Fix stale size in AbstractMapMultiSet view iterator remove (#701).
    
    Add assertion.
---
 src/changes/changes.xml                                               | 1 +
 .../apache/commons/collections4/multiset/AbstractMultiSetTest.java    | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bf44f0ae4..8a52e2bc6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,6 +65,7 @@
     <action type="fix" dev="ggregory" due-to="Vasiliy Mikhailov, Gary 
Gregory">Validate deserialized size in CircularFifoQueue.readObject 
(#678).</action>
     <action type="fix" dev="ggregory" due-to="Vasiliy Mikhailov, Gary 
Gregory">Do not mutate the input map in SwitchTransformer.switchTransformer 
(#696).</action>
     <action type="fix" dev="ggregory" due-to="Naveed Khan, Gary Gregory">Do 
not mutate the input map in SwitchClosure.switchClosure, 
ClosureUtils.switchMapClosure and TransformerUtils.switchMapTransformer 
(#700).</action>
+    <action type="fix" dev="ggregory" due-to="Dexter.k, Gary Gregory">Fix 
stale size in AbstractMapMultiSet view iterator remove (#701).</action>
     <!-- ADD -->
     <action type="add" dev="ggregory" due-to="Gary Gregory">Add generics to 
UnmodifiableIterator for the wrapped type.</action>
     <action type="add" dev="ggregory" due-to="Gary Gregory">Add a Maven 
benchmark profile for JMH.</action>
diff --git 
a/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
 
b/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
index 966ae6f1b..8d35bdb12 100644
--- 
a/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
@@ -579,18 +579,18 @@ public abstract class AbstractMultiSetTest<T> extends 
AbstractCollectionTest<T>
         final MultiSet<T> multiset = makeObject();
         multiset.add((T) "A", 3);
         multiset.add((T) "B", 2);
-
         final Iterator<T> unique = multiset.uniqueSet().iterator();
         final T removed = unique.next();
         final int removedCount = multiset.getCount(removed);
         unique.remove();
+        assertThrows(IllegalStateException.class, unique::remove);
         assertEquals(5 - removedCount, multiset.size());
         assertFalse(multiset.contains(removed));
         assertEquals(multiset.size(), multiset.toArray().length);
-
         final Iterator<MultiSet.Entry<T>> entries = 
multiset.entrySet().iterator();
         entries.next();
         entries.remove();
+        assertThrows(IllegalStateException.class, unique::remove);
         assertEquals(0, multiset.size());
         assertTrue(multiset.isEmpty());
         assertEquals(0, multiset.toArray().length);

Reply via email to