Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
ChangeSet does not synchronize whilst using the Iterator on the Set "changes" which is a synchronizedSet.
The Javadoc for Collections.synchronizedSet says: "
...
It is imperative that the user manually synchronize on the returned set when iterating over it:
...
Failure to follow this advice may result in non-deterministic behavior."
This affects the add() and perfom() methods.
Also, the asSet() method returns a reference to the Set. This method does not seem to be used at present, so perhaps could be removed.
Otherwise, it should either return a copy of the set, or the Javadoc should point out that any iteration over the set must synchronize on the set.