DFA - added Boolean.TRUE/FALSE.equals() quick fix to unbox boolean nullable variable

GitOrigin-RevId: 45952b11139cf435e218ddd9c3ba57e237230eed
This commit is contained in:
Ilyas Selimov
2021-05-12 18:40:43 +07:00
committed by intellij-monorepo-bot
parent 445cb5d8d2
commit a117b21680
11 changed files with 160 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
// "Replace with 'Boolean.FALSE.equals(flag)'" "true"
import org.jetbrains.annotations.Nullable;
class Test {
public boolean b;
public boolean c;
boolean test(@Nullable Boolean flag) {
return c ? b && Boolean.FALSE.equals(flag) : c;
}
}

View File

@@ -0,0 +1,12 @@
// "Replace with 'Boolean.TRUE.equals(flag)'" "true"
import org.jetbrains.annotations.Nullable;
class Test {
boolean test(@Nullable Boolean flag) {
if (Boolean.TRUE.equals(flag)) {
System.out.println("ok");
}
return true;
}
}

View File

@@ -0,0 +1,12 @@
// "Replace with 'Boolean.FALSE.equals(flag)'" "true"
import org.jetbrains.annotations.Nullable;
class Test {
public boolean b;
public boolean c;
boolean test(@Nullable Boolean flag) {
return c ? b && !<caret>flag : c;
}
}

View File

@@ -0,0 +1,12 @@
// "Replace with 'Boolean.TRUE.equals(flag)'" "true"
import org.jetbrains.annotations.Nullable;
class Test {
boolean test(@Nullable Boolean flag) {
if (<caret>flag) {
System.out.println("ok");
}
return true;
}
}

View File

@@ -0,0 +1,9 @@
// "Replace with 'Boolean.TRUE.equals(flag)'" "false"
import org.jetbrains.annotations.Nullable;
class Test {
int test(@Nullable Integer i) {
return <caret>i;
}
}

View File

@@ -0,0 +1,12 @@
// "Replace with 'Boolean.TRUE.equals(flag)'" "false"
import org.jetbrains.annotations.Nullable;
class Test {
boolean test(@NotNull Boolean flag) {
if (<caret>flag) {
System.out.println("ok");
}
return true;
}
}