mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
The local inspection for redundant throws didn't use to check if the method was called somewhere where it was in a try-catch block, so removing what seemed to be a redundant throw used to lead to red code because of the corresponding try-catch sections. This patch amends both the local and the global inspections for redundant throws, so the local inspeciton checks if it's cheap enough to find such try-catch sections and if not it assumes that there is a try-catch section somewhere. The global inspeciton looks for all the references to the method and finds all the try-catch sections that are related to it. The inspeciton removes the corresponding catch sections if possible or amends the type of catch sections if their type is an instance of a disjunction type. Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com> GitOrigin-RevId: 076f2a974326700172c8796a4d28df8fe0dd4546
20 lines
309 B
Java
20 lines
309 B
Java
// "FileNotFoundException" "true"
|
|
import java.io.FileNotFoundException;
|
|
|
|
class Main {
|
|
public void f() throws <caret>FileNotFoundException {}
|
|
{
|
|
try {
|
|
f();
|
|
} catch (FileNotFoundException e) {}
|
|
}
|
|
}
|
|
|
|
class B {
|
|
{
|
|
try {
|
|
new Main().f();
|
|
} catch (FileNotFoundException e) {}
|
|
}
|
|
}
|