[jsp] fixes unhandled exceptions highlighting in inner classes and lambda expressions

This commit is contained in:
Roman Shevchenko
2015-07-23 17:08:15 +02:00
parent 8b80f72a06
commit d66a9bda00
2 changed files with 23 additions and 11 deletions
@@ -798,16 +798,17 @@ public class HighlightUtil extends HighlightUtilBase {
}
@Nullable
private static HighlightInfoType getUnhandledExceptionHighlightType(final PsiElement element) {
if (!FileTypeUtils.isInServerPageFile(element)) {
return HighlightInfoType.UNHANDLED_EXCEPTION;
private static HighlightInfoType getUnhandledExceptionHighlightType(PsiElement element) {
// JSP top level errors are handled by UnhandledExceptionInJSP inspection
if (FileTypeUtils.isInServerPageFile(element)) {
PsiMethod targetMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class, true, PsiLambdaExpression.class);
if (targetMethod instanceof SyntheticElement) {
return null;
}
}
PsiMethod targetMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
if (!(targetMethod instanceof SyntheticElement)) return HighlightInfoType.UNHANDLED_EXCEPTION;
// ignore JSP top level errors - it handled by UnhandledExceptionInJSP inspection
return null;
}
return HighlightInfoType.UNHANDLED_EXCEPTION;
}
@Nullable
static HighlightInfo checkBreakOutsideLoop(@NotNull PsiBreakStatement statement) {