mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
SimplifyBooleanExpressionFix: fix 'while' handling after ensureCodeBlock improvements
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
// "Remove 'while' statement extracting side effects" "true"
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
class X {
|
||||
@Contract("_ -> true")
|
||||
boolean test(Object obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void doSmth(Object obj) {
|
||||
if (obj != null) {
|
||||
test(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Simplify 'test(...) || obj == null' to true extracting side effects" "true"
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
class X {
|
||||
@Contract("_ -> true")
|
||||
boolean test(Object obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void doSmth(Object obj) {
|
||||
while(obj != null) {
|
||||
test(obj);
|
||||
System.out.println("aaahh");
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Remove 'while' statement extracting side effects" "true"
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
class X {
|
||||
@Contract("_ -> true")
|
||||
boolean test(Object obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void doSmth(Object obj) {
|
||||
while(obj <caret>!= null && test(obj) && obj == null) {
|
||||
System.out.println("aaahh");
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Simplify 'test(...) || obj == null' to true extracting side effects" "true"
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
class X {
|
||||
@Contract("_ -> true")
|
||||
boolean test(Object obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void doSmth(Object obj) {
|
||||
while(obj != null && (test(obj) <caret>|| obj == null)) {
|
||||
System.out.println("aaahh");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user