mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-209947 Explain CCE warnings; merge explanations from different states
GitOrigin-RevId: b83e85b4712257fd536bca806790e2878bbf89a8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c64967f41b
commit
c11388a534
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Value is always false (x == null)
|
||||
One of the following happens:
|
||||
'x' was assigned (new Object())
|
||||
Expression cannot be null as it's newly created object (new Object())
|
||||
'x' was assigned ("foo")
|
||||
Expression cannot be null as it's literal ("foo")
|
||||
*/
|
||||
|
||||
class Test {
|
||||
void test(boolean b) {
|
||||
Object x;
|
||||
if (b) {
|
||||
x = new Object();
|
||||
} else {
|
||||
x = "foo";
|
||||
}
|
||||
if (<selection>x == null</selection>) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Value is always false (y == null)
|
||||
'y' was assigned (x)
|
||||
One of the following happens:
|
||||
'x' was assigned (new Object())
|
||||
Expression cannot be null as it's newly created object (new Object())
|
||||
'x' was assigned ("foo")
|
||||
Expression cannot be null as it's literal ("foo")
|
||||
*/
|
||||
|
||||
class Test {
|
||||
void test(boolean b) {
|
||||
Object x;
|
||||
if (b) {
|
||||
x = new Object();
|
||||
} else {
|
||||
x = "foo";
|
||||
}
|
||||
Object y = x;
|
||||
if (<selection>y == null</selection>) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
Cast may fail ((Integer)x)
|
||||
An object type is exactly String which is not a subtype of Integer (x)
|
||||
Type of 'x' is known from line #9 (x instanceof String)
|
||||
*/
|
||||
|
||||
class Test {
|
||||
void test(Object x) {
|
||||
if (x instanceof String) {
|
||||
System.out.println(<selection>(Integer)x</selection>);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
Cast may fail ((Integer)x)
|
||||
An execution might exist where...
|
||||
An object type is exactly Double which is not a subtype of Integer (x)
|
||||
Type of 'x' is known from line #14 (x instanceof Double)
|
||||
An object type is exactly String which is not a subtype of Integer (x)
|
||||
Type of 'x' is known from line #12 (x instanceof String)
|
||||
*/
|
||||
|
||||
class Test {
|
||||
void test(Object x) {
|
||||
if (x instanceof String) {
|
||||
}
|
||||
if (x instanceof Double) {
|
||||
}
|
||||
System.out.println(<selection>(Integer)x</selection>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
Cast may fail ((Integer)x)
|
||||
An execution might exist where...
|
||||
An object type is exactly String which is not a subtype of Integer (x)
|
||||
Type of 'x' is known from line #10 (x instanceof String)
|
||||
*/
|
||||
|
||||
class Test {
|
||||
void test(Object x) {
|
||||
if (x instanceof String) {
|
||||
}
|
||||
System.out.println(<selection>(Integer)x</selection>);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user