mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
[Johnny Clasrk] IsNull IsNotNull True False Checks and Assertions (IDEA-35808)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
public class AssertFalse {
|
||||
void bar() {
|
||||
final boolean b = call();
|
||||
if (Assertions.assertFalse(b)) {
|
||||
if(<warning descr="Condition 'b' is always 'false'">b</warning>) {}
|
||||
}
|
||||
}
|
||||
boolean call() {return true;}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import java.lang.*;
|
||||
|
||||
public class AssertIsNotNull {
|
||||
void bar() {
|
||||
final Object o = call();
|
||||
Assertions.assertIsNotNull(o);
|
||||
if(<warning descr="Condition 'o == null' is always 'false'">o == null</warning>) {}
|
||||
}
|
||||
Object call() {return new Object();}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import java.lang.*;
|
||||
|
||||
public class AssertIsNull {
|
||||
void bar() {
|
||||
final Object o = call();
|
||||
Assertions.assertIsNull(o);
|
||||
if(<warning descr="Condition 'o == null' is always 'true'">o == null</warning>) {}
|
||||
}
|
||||
Object call() {return new Object();}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class AssertTrue {
|
||||
void bar() {
|
||||
final boolean b = call();
|
||||
if (Assertions.assertTrue(b)) {
|
||||
if(<warning descr="Condition 'b' is always 'true'">b</warning>) {}
|
||||
}
|
||||
}
|
||||
boolean call() {return true;}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class IsNotNullCheck {
|
||||
void bar() {
|
||||
final Value v = call();
|
||||
if (Value.isNotNull(v)) {
|
||||
if(<warning descr="Condition 'v == null' is always 'false'">v == null</warning>) {}
|
||||
}
|
||||
}
|
||||
Value call() {return new Value();}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class IsNullCheck {
|
||||
void bar() {
|
||||
final Value v = call();
|
||||
if (Value.isNull(v)) {
|
||||
if(<warning descr="Condition 'v == null' is always 'true'">v == null</warning>) {}
|
||||
}
|
||||
}
|
||||
Value call() {return new Value();}
|
||||
}
|
||||
Reference in New Issue
Block a user