This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException
- From: "rmathew at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Apr 2006 07:05:05 -0000
- Subject: [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException
- References: <bug-27028-9773@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from rmathew at gcc dot gnu dot org 2006-04-05 07:05 -------
(In reply to comment #2)
> The difference between Sun's and Classpath's implementation appears to be that
> Classpath will check for Concurrent Modification on both hasNext() and next()
> calls, while Sun's implementation only checks next() calls.
I would argue that Sun's implementation is correct in this case in the
sense that hasNext() doesn't actually modify anything, only next() does.
I agree that the user code is buggy, gets a potentially bogus answer with
hasNext() and is simply asking for trouble, but the said trouble doesn't
happen unless it actually calls next(). You cannot throw an exception on
me if I merely intend to screw up - do that only if I actually screw up.
My 2p.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028