MoveConditionToLoopInspection: change name : IDEA-185134

This commit is contained in:
Roman Ivanov
2018-01-25 16:02:05 +07:00
parent 7f83ede73b
commit 6b81e567cc
15 changed files with 16 additions and 16 deletions

View File

@@ -0,0 +1,9 @@
// "Move condition to loop" "true"
class Main {
public static void main(String[] args) {
int i = 0;
while (i < 12) {
i++;
}
}
}

View File

@@ -0,0 +1,9 @@
// "Move condition to loop" "true"
class Main {
public static void main(String[] args) {
int i = 0;
do {
i++;
} while (i < 12);
}
}

View File

@@ -0,0 +1,10 @@
// "Move condition to loop" "true"
class Main {
public static void main(String[] args) {
int i = 0;
// negative i is invalid - stop here
do {
i++;
} while (i >= 0);
}
}

View File

@@ -0,0 +1,15 @@
// "Move condition to loop" "true"
class Main {
public static void main(String[] args) {
int i = 0;
/*1*/
/*2*/
/*3*/
/*7*/
/*8*/
while (i < 12) {
/*4*/
i =/*5*/ i + 1;/*6*/
}
}
}

View File

@@ -0,0 +1,10 @@
// "Move condition to loop" "true"
class Main {
public static void main(String[] args) {
int i = 0;
for<caret>(;;) {
if(i >= 12) break;
i++;
}
}
}

View File

@@ -0,0 +1,10 @@
// "Move condition to loop" "true"
class Main {
public static void main(String[] args) {
int i = 0;
while<caret>(true) {
i++;
if(i >= 12) break;
}
}
}

View File

@@ -0,0 +1,13 @@
// "Move condition to loop" "true"
class Main {
public static void main(String[] args) {
int i = 0;
while<caret>(true) {
i++;
if(i < 0) {
// negative i is invalid - stop here
break;
}
}
}
}

View File

@@ -0,0 +1,11 @@
// "Move condition to loop" "false"
class Main {
public static void main(String[] args) {
int i = 0;
while<caret>((true) {
i++;
if(i == 4) continue;
if(i >= 12) break;
}
}
}

View File

@@ -0,0 +1,11 @@
// "Move condition to loop" "false"
class Main {
public static void main(String[] args) {
int i = 0;
while<caret>(true) {
i++;
int j = i;
if(j >= 12) break;
}
}
}

View File

@@ -0,0 +1,11 @@
// "Move condition to loop" "true"
class Main {
public static void main(String[] args) {
int i = 0;
while<caret>(true/*7*/) /*8*/ {
if(i >= 12/*1*/)/*2*/ break;/*3*/
/*4*/
i =/*5*/ i + 1;/*6*/
}
}
}