Bug 565335

Summary: [quickfix] enhanced loop quickfix preview nested loops wrong
Product: [Eclipse Project] JDT Reporter: Carsten Hammer <carsten.hammer>
Component: UIAssignee: Carsten Hammer <carsten.hammer>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: kalyan_prasad
Version: 4.17   
Target Milestone: 4.16 M3   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Carsten Hammer CLA 2020-07-19 13:24:00 EDT
Just try this sample and click in the preview (1x import, 4x loop branches). Its difficult to explain but you see easily it is not ok. Especially the last branch for the inner loop of the second nested loop is strange.

import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;

public class A {
	public A() {
		Collection<Collection<String>> cc = Arrays.asList(Arrays.asList(""));
		for (final Iterator<Collection<String>> outer = cc.iterator(); outer.hasNext();) {
			final Collection<String> c = outer.next();
			for (final Iterator<String> inner = c.iterator(); inner.hasNext();) {
				System.out.println(inner.next());
			}
		}
	}

	void foo() {
		int[][] box = { { 1, 2 }, { 3, 4 } };
		for (int i = 0; i < box.length; i++) {
			int[] line = box[i];
			for (int j = 0; j < line.length; j++) {
				System.out.print(line[j]);
			}
		}
	}
}
Comment 1 Eclipse Genie CLA 2022-08-14 14:15:56 EDT
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.