This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]