Issue: https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1013
There's a bug currently on converting an iterable to enhanced for loop. When there is a statement like object.next(); The statement is omitted upon conversion even if the object belongs to a different class.
The problem is that in the block there's is no check for the iterator variable before performing the operation and it must be added.
public void foo() throws IOException {
Test i = new Test();
for (Iterator<String> iterator = c.iterator(); iterator.hasNext();) {
i.next();
iterator.next();
}
}
class Test {
public Object next() {
return null;
}
}
Upon Conversion:
Current Behavior
public void foo() {
Test i = new Test();
for (String string: c) {
}
}
Expected Behavior
public void foo() {
Test i = new Test();
for (String string: c) {
i.next();
}
}
Issue: https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1013 There's a bug currently on converting an iterable to enhanced for loop. When there is a statement like object.next(); The statement is omitted upon conversion even if the object belongs to a different class.
The problem is that in the block there's is no check for the iterator variable before performing the operation and it must be added.
Upon Conversion:
Current Behavior
Expected Behavior