unhandled exceptions: fix retained

This commit is contained in:
Anna Kozlova
2013-06-24 21:16:08 +04:00
parent f942830e06
commit d397653008
2 changed files with 83 additions and 1 deletions
@@ -20,3 +20,58 @@ class Main {
throwsNothing.f();
}
}
interface A {
void close() throws Exception;
}
interface B {
void close() throws IOException;
}
abstract class AB implements A, B {}
abstract class BA implements B, A {}
class ABUsage {
void foo(AB ab) {
try {
ab.close();
}
catch (IOException ignored) {}
}
void foo(BA ba) {
try {
ba.close();
}
catch (IOException ignored) {}
}
}
interface C {
void close();
}
interface D {
void close() throws IOException;
}
abstract class CD implements C, D {}
abstract class DC implements D, C {}
class CDUsage {
void foo(CD cd) {
try {
cd.close();
}
catch (<error descr="Exception 'java.io.IOException' is never thrown in the corresponding try block">IOException ignored</error>) {}
}
void foo(DC dc) {
try {
dc.close();
}
catch (<error descr="Exception 'java.io.IOException' is never thrown in the corresponding try block">IOException ignored</error>) {}
}
}