dfa: store CCE state in visitor, not runner: the latter is reused which can result in multiple warning

This commit is contained in:
peter
2015-09-01 21:48:59 +02:00
parent d811626884
commit bf4a3805e0
4 changed files with 33 additions and 37 deletions
@@ -0,0 +1,21 @@
class X {
public static void main(Object result) {
final boolean varargs = result instanceof Intf;
new Runnable() {
public void run() { }
};
Intf a = (<warning descr="Casting 'result' to 'Intf' may produce 'java.lang.ClassCastException'">Intf</warning>)result;
}
public static void main2(Object result) {
final boolean varargs = result instanceof Intf;
if (!varargs) return;
new Runnable() {
public void run() { }
};
if (<warning descr="Condition 'result instanceof Intf' is always 'true'">result instanceof Intf</warning>) {
System.out.println();
}
}
}
interface Intf {}