mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[jsp] fixes unhandled exceptions highlighting in inner classes and lambda expressions
This commit is contained in:
+9
-8
@@ -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) {
|
||||
|
||||
@@ -369,11 +369,19 @@ public class ExceptionUtil {
|
||||
visitElement(statement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLambdaExpression(PsiLambdaExpression expression) {
|
||||
if (ArrayUtil.find(elements, expression) >= 0) {
|
||||
visitElement(expression);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMethodReferenceExpression(@NotNull PsiMethodReferenceExpression expression) {
|
||||
if (ArrayUtil.find(elements, expression) < 0) return;
|
||||
addExceptions(array, getUnhandledExceptions(expression, null));
|
||||
visitElement(expression);
|
||||
if (ArrayUtil.find(elements, expression) >= 0) {
|
||||
addExceptions(array, getUnhandledExceptions(expression, null));
|
||||
visitElement(expression);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -387,6 +395,9 @@ public class ExceptionUtil {
|
||||
addExceptions(array, getUnhandledCloserExceptions(resource, null));
|
||||
visitElement(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClass(PsiClass aClass) { }
|
||||
};
|
||||
|
||||
for (PsiElement element : elements) {
|
||||
|
||||
Reference in New Issue
Block a user