Github user paplorinc commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/360#discussion_r69131220
  
    --- Diff: src/main/groovy/lang/ObjectRange.java ---
    @@ -408,107 +401,86 @@ public void step(int step, Closure closure) {
          */
         @Override
         public Iterator iterator() {
    -        // non thread-safe iterator
    -        final Iterator innerIterator = new StepIterator(this, 1);
    -        final Iterator safeIterator = new Iterator() {
    +        return new Iterator() {
    +            private final Iterator delegate = new 
LazySteppingIterator(ObjectRange.this, 1);
    +
                 @Override
                 public synchronized boolean hasNext() {
    -                return innerIterator.hasNext();
    +                return delegate.hasNext();
                 }
     
                 @Override
                 public synchronized Object next() {
    -                return innerIterator.next();
    +                return delegate.next();
                 }
     
                 @Override
    -            public void remove() {
    -                innerIterator.remove();
    +            public synchronized void remove() {
    --- End diff --
    
    It wasn't synchronized before, since it throws an exception anyway.
    It's more consistent this way, though.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to