Bug 563317 - [cleanup] Convert iterable loop: Loose code matching
Summary: [cleanup] Convert iterable loop: Loose code matching
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.16   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.17 M1   Edit
Assignee: Fabrice Tiercelin CLA
QA Contact: Jeff Johnston CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-19 01:16 EDT by Fabrice Tiercelin CLA
Modified: 2020-08-20 14:08 EDT (History)
3 users (show)

See Also:
noopur_gupta: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabrice Tiercelin CLA 2020-05-19 01:16:23 EDT
Given:
for (Iterator<String> iterator= (c.iterator() == null) ? otherIterator : anotherIterator; iterator.hasNext();) {
  String test= iterator.next();
  System.out.println(test);
}

When:
Converting iterable loop...

Actual:
for (String test : c) {
  System.out.println(test);
}

Expected:
No cleanup


The cleanup searches the matching iterator in any child node, whatever the intermediate nodes are. It's dangerous. We should search what is actually assigned.
Comment 1 Eclipse Genie CLA 2020-05-19 01:19:49 EDT
New Gerrit change created: https://git.eclipse.org/r/163217
Comment 3 Andrey Loskutov CLA 2020-05-25 04:15:10 EDT
Are you aware, that we are in RC1, and that we have special rules for RC1 fixes?

See https://www.eclipse.org/lists/platform-dev/msg02275.html
https://www.eclipse.org/eclipse/development/plans/freeze_plan_4_16.php

Please get +1 from JDT UI project lead or revert your change.

Additionally: in the future, if you close a bug, set the Target Milestone to the appropriate value.
Comment 4 Eclipse Genie CLA 2020-05-26 03:29:52 EDT
New Gerrit change created: https://git.eclipse.org/r/163575
Comment 6 Noopur Gupta CLA 2020-05-26 03:41:46 EDT
+1 to revert for RC1.
Comment 7 Eclipse Genie CLA 2020-06-11 12:59:38 EDT
New Gerrit change created: https://git.eclipse.org/r/164717
Comment 9 Dani Megert CLA 2020-06-12 10:13:15 EDT
Versions need to be increased:
https://download.eclipse.org/eclipse/downloads/drops4/I20200612-0650/buildlogs/reporeports/reports/versionChecks.html

See 'IUs in current repo that increase versions but with qualifier only' section.
Comment 10 Jeff Johnston CLA 2020-08-20 14:08:58 EDT
Verified for 4.17M3 using I20200818-0900 build