mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-17 11:40:50 +07:00
22 lines
664 B
Java
22 lines
664 B
Java
import java.util.Date;
|
|
|
|
class DataFlowBug {
|
|
|
|
private static boolean isNumberable(Object o) {
|
|
return o instanceof Number;
|
|
}
|
|
|
|
public Object add(Object left, Object right) {
|
|
if (left != null && right != null && (left instanceof Date || right instanceof Date)) {
|
|
if (isNumberable(left)) {
|
|
return ((<warning descr="Casting 'right' to 'Date' may produce 'java.lang.ClassCastException'">Date</warning>) right).getTime();
|
|
}
|
|
|
|
if (isNumberable(right)) {
|
|
return ((<warning descr="Casting 'left' to 'Date' may produce 'java.lang.ClassCastException'">Date</warning>) left).getTime();
|
|
}
|
|
}
|
|
return new Object();
|
|
}
|
|
|
|
} |