IDEA-97977 Constant conditions & exceptions: instance check on Throwable are wrong

This commit is contained in:
peter
2013-01-14 19:07:42 +01:00
parent 5aebb2e977
commit 065f0bc7f8
4 changed files with 73 additions and 41 deletions
@@ -0,0 +1,30 @@
class Test {
Object m1(String[] args) throws Exception {
try {
return <warning descr="'null' is returned by the method which isn't declared as @Nullable">null</warning>;
}
catch (Throwable t) {
if (t instanceof Error) {
System.err.println("1");
}
if (!(t instanceof RuntimeException)) {
System.err.println("2");
}
return null;
}
}
void m2(String[] args) throws Exception {
try {
System.out.println();
}
catch (Throwable t) {
if (t instanceof Error) {
System.err.println("1");
}
if (!(t instanceof RuntimeException)) {
System.err.println("2");
}
}
}
}