Files
openide/java/java-tests/testData/inspection/redundantThrowsGlobalFix/afterHandleSuperException.java
Nikita Eshkeev 8583627c45 [java-analysis-impl] IDEA-248487 Red code after "Remove unnecessary 'throws' declarations"
The algorithm of deducing of how catch type and instructions in a try statement are related didn't use to be robust, this patch introduces a graph based approach to capture the essence of catch types and instructions in a try statement relation.

The graph is a DAG with catch sections on the top level, they are connected to exceptions vertices: since a catch section can have a disjoint set of types in its declaration, each catch section vertex can have a multiple children. At the lowest level there are instructions of a try statement that induce exceptions. Such a structure of a graph makes it possible to implement a robust algorithm to deduce essential types in catch sections.

Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>

GitOrigin-RevId: 8cd2a8223ff0b472d8dfde3e611b4797edb36d5a
2020-09-17 16:27:25 +00:00

31 lines
430 B
Java

// "Ex4" "true"
class Hello {
public void g() { }
{
g();
g();
try {
g();
g();
} catch (Exception ex2) {
ex2.printStackTrace();
}
}
}
class B {
{
new Hello().g();
new Hello().g();
try {
new Hello().g();
new Hello().g();
} catch (Exception ex2) {
ex2.printStackTrace();
}
}
}
class Ex1 extends Exception {}
class Ex2 extends Ex1 {}