mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
IDEA-143014 Wrong 'can be null' warning when assignment is done inside if condition
This commit is contained in:
+2
-2
@@ -8,8 +8,8 @@ class Contracts {
|
||||
if (y) System.out.println();
|
||||
|
||||
int k = 1;
|
||||
boolean z = (k +=1) == k; // returns true
|
||||
if (z) System.out.println();
|
||||
boolean z = <warning descr="Condition '(k +=1) == k' is always 'true'">(k +=1) == k</warning>; // returns true
|
||||
if (<warning descr="Condition 'z' is always 'true'">z</warning>) System.out.println();
|
||||
}
|
||||
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class Test {
|
||||
|
||||
@Nullable
|
||||
private static native String getNext();
|
||||
|
||||
public static void test() {
|
||||
String v = null;
|
||||
while ((v = getNext()) != null) {
|
||||
v.substring(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user