mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-209947 Report obviously not-null values; better propagation through assignment
GitOrigin-RevId: 2f6cd06b9750e8f080ab543af40b522f4c2bfefa
This commit is contained in:
committed by
intellij-monorepo-bot
parent
efcbb20422
commit
e12a1970e4
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
Value is always true (j >= 0)
|
||||
Left operand is >= 0 (j)
|
||||
'j' was assigned (i + 1)
|
||||
Result of '+' is >= 0 (i + 1)
|
||||
Left operand is in {-1..Integer.MAX_VALUE-1} (i)
|
||||
'i' was assigned (s.indexOf(' '))
|
||||
Value is in {-1..Integer.MAX_VALUE-1} (s.indexOf(' '))
|
||||
*/
|
||||
|
||||
class Test {
|
||||
private static void dosmth(String s) {
|
||||
int i = s.indexOf(' ');
|
||||
int j = i + 1;
|
||||
if (<selection>j >= 0</selection>) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
Value is always true ((s = new Object()) != null)
|
||||
's' was assigned (new Object())
|
||||
Expression cannot be null as it's newly created object (new Object())
|
||||
*/
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
Object s;
|
||||
if (<selection>(s = new Object()) != null</selection>) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
Value is always true (s != null)
|
||||
's' was assigned (new Object())
|
||||
Expression cannot be null as it's newly created object (new Object())
|
||||
*/
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
Object s = (new Object());
|
||||
if (<selection>s != null</selection>) {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user