This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
class WeakList<T> implements Iterable<T> provides only subset of functionality of WeakSet<T> in org.openide.util.
I agree that WeakSet does the same and more; but it isn't concurrent. Our WeakList ensures concurrency, which is quite important for C/C++ Language Model. If we use WeakSet, we have to either copy-paste concurrency-related code into the places that use it or to wrap it into another class that ensures concurrency.
Concurrency is a matter of Collections.synchronizedSet(new WeakSet()), but I'm more worried about the usage of WeakList. You do a lot of source-weak listening, which is quite unusual pattern. You could still have used WeakListeners class for this purpose, though.
The Set that is returned by Collections.synchronizedSet() has non-synchroneous iterator (I mean iterating it while other thread adds elements leads to CME), while WeakList copies the listener list under lock, then returns the iterator over this copy. As to the usage of this weak list, probably it should be reviewed. But the initial request - as I understand - was to change WeakList to WeakSet. I don't think this should be done.
OK, agreed.
x