Community
Participate
Working Groups
Bug 548002 added enhanced for each conversion based on collection iteration. That change leads to wrong compilable code when using 4.13M3, since it does not check whether other collections are based on the loop index. Reproduction example: List<File> a = new ArrayList<>(); List<File> b = new ArrayList<>(); for (int i = 0; i < a.size(); i++) { System.out.print(a.get(i) + " " + b.get(i)); } The "enhanced for loop conversion" quickfix is available on that loop, although it iterates 2 collections and converts this to the completely wrong, but compilable List<File> a = new ArrayList<>(); List<File> b = new ArrayList<>(); for (File element : a) { System.out.print(element + " " + element); } I set this to blocking, since "convert to enhanced for loop" is also a save action, that exists since a long time. So it may be enabled for many long time users (like myself), and suddenly produces wrong compilable code on saving files, without further notice to the user.
For 4.13, the changes in bug 548002 will be reverted.
Noopur, if this bug is straightforward to fix wouldn't it be simpler to fix it?
(In reply to Alexander Kurtakov from comment #2) > Noopur, if this bug is straightforward to fix wouldn't it be simpler to fix > it? Yes, that would be fine. As discussed in bug 548002, I leave it to Jeff to also ensure that no such problems show up for 4.13 instead of reverting the feature.
New Gerrit change created: https://git.eclipse.org/r/148833
Noopur, I believe that the fix for this problem is straight-forward and have provided a patch including new tests. If the PMC would rather have a reversion, then I will revert the feature.
While testing this fix, I came across another regression bug 550726. Since this clean up is usually enabled as a save action in users' workspaces, these issues have a larger impact. I am fine with not reverting the feature due to code complications but please revisit all the changes released for bug 548002 and make sure that the obvious issues are fixed in 4.13.
Gerrit change https://git.eclipse.org/r/148833 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=29ad07cf61d1058b99fe81efc4fb692938202152
New Gerrit change created: https://git.eclipse.org/r/148902
Verified for 4.13RC2 using I20190904-1805 build