Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4200095
Votes 1
Synopsis (coll) overstated wording regarding fail-fast behavior of iterators
Category java:classes_util
Reported Against 1.2beta4
Release Fixed
State 5-Cause Known, bug
Priority: 4-Low
Related Bugs
Submit Date 29-DEC-1998
Description


Several places in the documentation, for example,
the method description for LinkedList.listIterator,
specify that certain iterators have fail-fast
behavior, stating:

  ... [I]f the LinkedList is structurally modified
  at any time after the Iterator is created, in any
  way except through the ListIterator's own remove
  or add methods, the Iterator will throw a Concurrent-
  ModificationException.  Thus, in the face of 
  concurrent modification, the Iterator fails quickly
  and cleanly, rather than risking arbitrary, non-
  deterministic behavior at an undetermined time in
  the future.

Something is wrong or unclear in the first sentence.

If the list is modified in some way other that via
the iterator, how can the Iterator get control to
throw an exception? 

If the iterator is not involved until the next 
time an Iterator method is called, then the wording
erroneously implies that things fail as soon as
the list is modified (instead of the next time the
iterator is used after the list is modified).

If the iterator _is_ involved at the time of the
modification (e.g., if the LinkedList verifies
that no iterators are active), then it's not the
Iterator that fails by throwing an exception;
it's some method of the LinkedList.


Therefore, the wording is unclear or inaccurate.




DSB/DFI
(Review ID: 40380)
======================================================================
Posted Date : 2005-09-27 06:52:42.0
Work Around
N/A
Evaluation
The wording is indeed not completely precise, but as often happens,
making it more precise tends to make it more language-lawyerly and
tbus less readable.  

I can't think off-hand of any way to avoid lawyerization.
Posted Date : 2006-05-14 03:08:59.0
Comments
  
  Include a link with my name & email   

Submitted On 20-JAN-2001
klni
The description is correct, you need to download and look in the JDK source 
to understand, or write a few test programs.



PLEASE NOTE: JDK6 is formerly known as Project Mustang