diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/InspectionRunner.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/InspectionRunner.java index f6aa1465249b..bf816b9d4dbe 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/InspectionRunner.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/InspectionRunner.java @@ -88,7 +88,7 @@ class InspectionRunner { // The containing file this tool was called for. In the case of injected context, this will be the injected file. @NotNull PsiFile psiFile) { @Override - public String toString() { + public @NotNull String toString() { return tool +"; inside:"+elementsInside().size()+"; outside:"+elementsOutside().size(); } } @@ -403,15 +403,22 @@ class InspectionRunner { * (starting from this inspection's most fertile elements if any), * maintaining parallelism during this process (i.e., several visitors from {@code init} can be executed concurrently, but elements from the list head get higher priority than the list tail). */ - private static void processContext(@NotNull InspectionContext context, List psiElements, + private static void processContext(@NotNull InspectionContext context, + @NotNull @Unmodifiable List psiElements, @NotNull InspectionVisitorOptimizer optimizer) { if (LOG.isTraceEnabled()) { LOG.trace("processContext: " + context + "; elements(" + psiElements.size() + "): " + StringUtil.join(psiElements, e-> e + "(" + e.getClass() + ")", ", ") + "; accepts=" + context.acceptingPsiTypes()); } - optimizer.acceptElements(psiElements, - context.acceptingPsiTypes, - psiElement -> context.holder.visitElement(psiElement, context.visitor)); + try { + optimizer.acceptElements(psiElements, + context.acceptingPsiTypes, + psiElement -> context.holder.visitElement(psiElement, context.visitor)); + } + catch (Throwable t) { + if (Logger.shouldRethrow(t)) throw t; + LOG.error(t); + } } private void injectedFound(@NotNull PsiFile injectedPsi, @NotNull PsiElement host, @NotNull LocalInspectionToolSession session,