mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 08:45:34 +07:00
Java: Fixed safe-deleting variable used in 'for' loop's update or init clause (IDEA-180217)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
class C {
|
||||
Object foo = null;
|
||||
|
||||
void case01() {
|
||||
Object problematic;
|
||||
int i = 10;
|
||||
for(<caret>problematic = foo; (--i) > 0; ) {
|
||||
System.out.println("index = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class C {
|
||||
Object foo = null;
|
||||
|
||||
void case01() {
|
||||
int i = 10;
|
||||
for(; (--i) > 0; ) {
|
||||
System.out.println("index = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class C {
|
||||
Object foo = null;
|
||||
|
||||
void case01() {
|
||||
Object problematic;
|
||||
int i;
|
||||
for(i = 10, <caret>problematic = foo; (--i) > 0; ) {
|
||||
System.out.println("index = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class C {
|
||||
Object foo = null;
|
||||
|
||||
void case01() {
|
||||
int i;
|
||||
for(i = 10; (--i) > 0; ) {
|
||||
System.out.println("index = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class C {
|
||||
Object foo = null;
|
||||
|
||||
void case01() {
|
||||
Object problematic;
|
||||
for(int i = 10; (--i) > 0; <caret>problematic = foo) {
|
||||
System.out.println("index = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class C {
|
||||
Object foo = null;
|
||||
|
||||
void case01() {
|
||||
for(int i = 10; (--i) > 0; ) {
|
||||
System.out.println("index = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class C {
|
||||
Object foo = null;
|
||||
|
||||
void case02() {
|
||||
Object problematic;
|
||||
for(int i = 10; i > 0; i--, <caret>problematic = foo) {
|
||||
System.out.println("index = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class C {
|
||||
Object foo = null;
|
||||
|
||||
void case02() {
|
||||
for(int i = 10; i > 0; i--) {
|
||||
System.out.println("index = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user