Community
Participate
Working Groups
When in the body of a loop the collection the loop is iterating on is changed then an access using a loop counter is maybe wrong but does not throw an java.util.ConcurrentModificationException. The enhanced loop quickfix changes the access to using the iterator build in to the collection object. Using the iterators delete method is working fine but not the collections delete. Depending on which Collection is used after the quickfix is applied the code is still running. It would be great if the quickfix could sort out some of the problems that can be introduced by either 1) suggesting a collection change to one of the concurrent or specialized variants 2) adding a comment explaining the situation 3) changing a collection delete to a iterator delete (is this possible?) 4) stay away from a refactoring if the body or a method called from the body changes the original collection (is this possible to find out on the AST?) Real world sample code is available in many parts of eclipse source code. I just created a fresh sample of a enhanced loop quickfix to see how such problems look like: https://git.eclipse.org/r/#/c/163148/ Have a look on the listener changes of TextViewer.java Such changes have caused issues in the past. see https://bugs.eclipse.org/bugs/show_bug.cgi?id=558510 Another sample: https://git.eclipse.org/r/#/c/153258/ It would be cool if the enhanced loop quickfix could be made smart enough to cover some of the problems potentially caused by such a change.
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=563562 for more samples
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.