Bug 565335 - [quickfix] enhanced loop quickfix preview nested loops wrong
Summary: [quickfix] enhanced loop quickfix preview nested loops wrong
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.17   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.16 M3   Edit
Assignee: Carsten Hammer CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-19 13:24 EDT by Carsten Hammer CLA
Modified: 2022-08-14 14:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.