mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Java intention: Quick fix for error "foreach not applicable to type java.util.Iterator" - handle comments and take care of empty block when copying the loop body (IDEA-124751)
This commit is contained in:
+1
@@ -6,6 +6,7 @@ public class CodeBlockBody {
|
||||
for (Iterator<Integer> it2 = it1; it2.hasNext(); ) {
|
||||
Integer integer = it2.next();
|
||||
System.out.println(integer + " a");
|
||||
// a comment
|
||||
System.out.println(integer + " b");
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace 'for each' loop with iterator 'for' loop" "true"
|
||||
import java.util.Iterator;
|
||||
|
||||
public class EmptyBlockBody {
|
||||
void foo(Iterator<Integer> it) {
|
||||
for (Iterator<Integer> it1 = it; it1.hasNext(); ) {
|
||||
Integer integer = it1.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -5,6 +5,7 @@ public class CodeBlockBody {
|
||||
void foo(Iterator<Integer> it,Iterator<Integer> it1) {
|
||||
for (Integer integer : <caret>it1) {
|
||||
System.out.println(integer + " a");
|
||||
// a comment
|
||||
System.out.println(integer + " b");
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace 'for each' loop with iterator 'for' loop" "true"
|
||||
import java.util.Iterator;
|
||||
|
||||
public class EmptyBlockBody {
|
||||
void foo(Iterator<Integer> it) {
|
||||
for (Integer integer : <caret>it) {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user