[ 
https://issues.apache.org/jira/browse/COLLECTIONS-802?focusedWorklogId=761563&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-761563
 ]

ASF GitHub Bot logged work on COLLECTIONS-802:
----------------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Apr/22 02:43
            Start Date: 25/Apr/22 02:43
    Worklog Time Spent: 10m 
      Work Description: kinow commented on PR #300:
URL: 
https://github.com/apache/commons-collections/pull/300#issuecomment-1108007330

   Thanks @ben-manes, much easier now to run the tests and compare the results 
with your updated test.
   
   For `master`:
   
   ```bash
   [ERROR] Failures: 
   [ERROR]   
CollectionIteratorTester.testIterator_unknownOrderRemoveSupported:111->runIteratorTest:133
 failed with stimuli [hasNext, hasNext, next, hasNext, remove]
   [ERROR]   
CollectionIteratorTester.testIterator_unknownOrderRemoveSupported:111->runIteratorTest:133
 failed with stimuli [hasNext, hasNext, next, hasNext, remove]
   [ERROR]   
CollectionIteratorTester.testIterator_unknownOrderRemoveSupported:111->runIteratorTest:133
 failed with stimuli [hasNext, hasNext, next, hasNext, remove]
   [ERROR]   
CollectionIteratorTester.testIterator_unknownOrderRemoveSupported:111->runIteratorTest:133
 failed with stimuli [next, next, next, hasNext, remove]
   [ERROR]   
CollectionIteratorTester.testIterator_unknownOrderRemoveSupported:111->runIteratorTest:133
 failed with stimuli [next, next, next, hasNext, remove]
   [ERROR]   
CollectionIteratorTester.testIterator_unknownOrderRemoveSupported:111->runIteratorTest:133
 failed with stimuli [next, next, next, hasNext, remove]
   [INFO] 
   [ERROR] Tests run: 25518, Failures: 6, Errors: 0, Skipped: 4
   [INFO] 
   ```
   
   Then for this branch:
   
   ```bash
   [INFO] Results:
   [INFO] 
   [WARNING] Tests run: 25520, Failures: 0, Errors: 0, Skipped: 4
   ```
   So no regressions in our CI, nor in the `ApacheMapTest` after this change 
:clap: 
   




Issue Time Tracking
-------------------

    Worklog Id:     (was: 761563)
    Time Spent: 1h 20m  (was: 1h 10m)

> ReferenceMap iterator remove violates contract
> ----------------------------------------------
>
>                 Key: COLLECTIONS-802
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-802
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Map
>    Affects Versions: 4.4
>            Reporter: Ben Manes
>            Priority: Minor
>         Attachments: ApacheMapTest-1.java, ApacheMapTest.java
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Out of curiosity I ran Guava's testlib Map tests against the Apache types. 
> This uncovered a contract bug where {{Iterator.remove()}} is invalidated by 
> {{{}hasNext(){}}}, causing its call to no-op due to {{currentKey}} becoming 
> {{{}null{}}}. The isolates case is,
> {code:java}
> @Test
> public void iterator_remove() {
>   var map = new ReferenceMap<>();
>   map.put(1, 2);
>   var iter = map.entrySet().iterator();
>   assertTrue(iter.hasNext());
>   assertTrue(iter.hasNext());
>   assertEquals(iter.next(), 1);
>   assertFalse(iter.hasNext());
>   iter.remove();
>   assertEquals(map, Map.of());
> }{code}
> Guava's [testlib|https://github.com/google/guava/tree/master/guava-testlib] 
> has good coverage for the Collections Framework and might be worth 
> integrating. The simple test case that I wrote is attached.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to