mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
Java: Don't report the catch section as unreachable where a subclass of declared exception can be thrown (IDEA-175863)
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
class C {
|
||||
void foo(boolean b) throws Exception {
|
||||
try {
|
||||
if (b) {
|
||||
throw new ChildException();
|
||||
} else {
|
||||
method();
|
||||
}
|
||||
} catch (ChildException e) {
|
||||
System.out.println("child");
|
||||
} catch (ParentException e) {
|
||||
System.out.println("parent");
|
||||
}
|
||||
}
|
||||
|
||||
private static void method() throws Exception {
|
||||
throw new ParentException();
|
||||
}
|
||||
|
||||
static class ParentException extends Exception { }
|
||||
|
||||
static class ChildException extends ParentException { }
|
||||
}
|
||||
Reference in New Issue
Block a user