diff --git a/platform/lang-impl/src/com/intellij/codeInspection/GlobalInspectionUtil.java b/platform/lang-impl/src/com/intellij/codeInspection/GlobalInspectionUtil.java index 2a253f474c73..e93e4365c39b 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/GlobalInspectionUtil.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/GlobalInspectionUtil.java @@ -29,7 +29,7 @@ import com.intellij.psi.PsiFile; public class GlobalInspectionUtil { private static final String LOC_MARKER = " #loc"; - static RefElement retrieveRefElement(PsiElement element, GlobalInspectionContext globalContext) { + public static RefElement retrieveRefElement(PsiElement element, GlobalInspectionContext globalContext) { PsiFile elementFile = element.getContainingFile(); RefElement refElement = globalContext.getRefManager().getReference(elementFile); if (refElement == null) { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/LocalInspectionToolWrapper.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/LocalInspectionToolWrapper.java index 8586b1133a2e..0f9633076d0b 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/LocalInspectionToolWrapper.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/LocalInspectionToolWrapper.java @@ -101,6 +101,9 @@ public final class LocalInspectionToolWrapper extends DescriptorProviderInspecti final PsiNamedElement problemElement = myTool.getProblemElement(elt); RefElement refElement = refManager.getReference(problemElement); + if (refElement == null && problemElement != null) { // no need to loose collected results + refElement = GlobalInspectionUtil.retrieveRefElement(elt, getContext()); + } List elementProblems = problems.get(refElement); if (elementProblems == null) { elementProblems = new ArrayList();