mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IG: handle classes and lambda's correctly in "Overly broad 'catch' block" inspection
This commit is contained in:
+7
-9
@@ -242,17 +242,15 @@ public class ExceptionUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMethodCallExpression(@NotNull PsiMethodCallExpression expression) {
|
||||
super.visitMethodCallExpression(expression);
|
||||
final PsiMethod method = expression.resolveMethod();
|
||||
collectExceptionsThrown(method, m_exceptionsThrown);
|
||||
}
|
||||
public void visitClass(PsiClass aClass) {}
|
||||
|
||||
@Override
|
||||
public void visitNewExpression(@NotNull PsiNewExpression expression) {
|
||||
super.visitNewExpression(expression);
|
||||
final PsiMethod method = expression.resolveMethod();
|
||||
collectExceptionsThrown(method, m_exceptionsThrown);
|
||||
public void visitLambdaExpression(PsiLambdaExpression expression) {}
|
||||
|
||||
@Override
|
||||
public void visitCallExpression(PsiCallExpression callExpression) {
|
||||
super.visitCallExpression(callExpression);
|
||||
collectExceptionsThrown(callExpression.resolveMethod(), m_exceptionsThrown);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+11
@@ -85,4 +85,15 @@ public class TooBroadCatchBlock{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void m3() {
|
||||
try {
|
||||
new Object() {
|
||||
void f() throws FileNotFoundException {
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
};
|
||||
throw new IOException();
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user