mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 14:25:04 +07:00
IDEA-178774 Unroll loop intention action
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
// "Unroll loop" "true"
|
||||
class Test {
|
||||
void test(Object y) {
|
||||
System.out.println((Object) "one");
|
||||
if (!(Math.random() > 0.5)) {
|
||||
System.out.println((Object) 1);
|
||||
if (!(Math.random() > 0.5)) {
|
||||
System.out.println((Object) 1.0);
|
||||
if (!(Math.random() > 0.5)) {
|
||||
System.out.println((Object) 1.0f);
|
||||
if (!(Math.random() > 0.5)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Unroll loop" "true"
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
if (!"foo".isEmpty()) {
|
||||
System.out.println("foo");
|
||||
}
|
||||
if (!"bar".isEmpty()) {
|
||||
System.out.println("bar");
|
||||
}
|
||||
if (!"baz".isEmpty()) {
|
||||
System.out.println("baz");
|
||||
}
|
||||
if (!"".isEmpty()) {
|
||||
System.out.println("");
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Unroll loop" "true"
|
||||
class Test {
|
||||
void test() {
|
||||
System.out.println(1);
|
||||
System.out.println(2);
|
||||
System.out.println(3);
|
||||
System.out.println(4);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Unroll loop" "true"
|
||||
class Test {
|
||||
void test() {
|
||||
foo(true);
|
||||
unresolved(!true);
|
||||
foo(false);
|
||||
unresolved(!false);
|
||||
}
|
||||
|
||||
void foo(boolean b) {}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Unroll loop" "false"
|
||||
class Test {
|
||||
void test() {
|
||||
fo<caret>r(Object x : new Object[] {"one", 1, 1.0, 1.0f}) {
|
||||
if(Math.random() > 0.5) break;
|
||||
System.out.println(x);
|
||||
}
|
||||
}
|
||||
|
||||
void foo(boolean b) {}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Unroll loop" "true"
|
||||
class Test {
|
||||
void test(Object y) {
|
||||
fo<caret>r(Object x : new Object[] {"one", 1, 1.0, 1.0f}) {
|
||||
System.out.println(x);
|
||||
if(Math.random() > 0.5) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Unroll loop" "true"
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
fo<caret>r(String s : Arrays.asList("foo", "bar", "baz", "")) {
|
||||
if(!s.isEmpty()) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Unroll loop" "true"
|
||||
class Test {
|
||||
void test() {
|
||||
fo<caret>r(int i : new int[] {1,2,3,4}) {
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Unroll loop" "true"
|
||||
class Test {
|
||||
void test() {
|
||||
boolean steps = {true, false};
|
||||
fo<caret>r(boolean step : steps) {
|
||||
foo(step);
|
||||
unresolved(!step);
|
||||
}
|
||||
}
|
||||
|
||||
void foo(boolean b) {}
|
||||
}
|
||||
Reference in New Issue
Block a user