mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
don't let null checks affect 'unchecked cast' analysis
This commit is contained in:
@@ -36,7 +36,7 @@ class Test {
|
||||
System.out.println(r);
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (e instanceof ResourcefulException1) {
|
||||
if (<warning descr="Condition 'e instanceof ResourcefulException1' is always 'false'">e instanceof ResourcefulException1</warning>) {
|
||||
System.out.println("1");
|
||||
}
|
||||
else if (e instanceof ResourcefulException2) {
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
public class DataFlowBug {
|
||||
|
||||
public int add2(Object left, Object right) {
|
||||
if (left != null && !(left instanceof String)) {
|
||||
return ((<warning descr="Casting 'left' to 'String' may produce 'java.lang.ClassCastException'">String</warning>) left).length();
|
||||
|
||||
}
|
||||
if (!(right instanceof String)) {
|
||||
return ((<warning descr="Casting 'right' to 'String' may produce 'java.lang.ClassCastException'">String</warning>) right).length();
|
||||
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user