From c63856f2f881f0724516da506156cf4efda3e4ff Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 12 Nov 2009 14:44:40 +0300 Subject: [PATCH] verbose diagnostics --- .../com/intellij/codeInspection/ProblemsHolder.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/lang-api/src/com/intellij/codeInspection/ProblemsHolder.java b/platform/lang-api/src/com/intellij/codeInspection/ProblemsHolder.java index 30d46f0e7788..e625833667ba 100644 --- a/platform/lang-api/src/com/intellij/codeInspection/ProblemsHolder.java +++ b/platform/lang-api/src/com/intellij/codeInspection/ProblemsHolder.java @@ -37,7 +37,7 @@ public class ProblemsHolder { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ProblemsHolder"); private final InspectionManager myManager; private final PsiFile myFile; - private boolean myOnTheFly; + private final boolean myOnTheFly; private List myProblems = null; public ProblemsHolder(@NotNull InspectionManager manager, @NotNull PsiFile file, boolean onTheFly) { @@ -63,7 +63,13 @@ public class ProblemsHolder { } PsiElement element = problemDescriptor.getPsiElement(); if (element != null && !isInPsiFile(element)) { - LOG.error("Reported element " + element + " is not from the file '" + myFile + "' the inspection was invoked for. Message:" + problemDescriptor.getDescriptionTemplate()); + PsiFile containingFile = element.getContainingFile(); + PsiElement context = containingFile.getContext(); + PsiElement myContext = myFile.getContext(); + LOG.error("Reported element " + element + " is not from the file '" + myFile + "' the inspection was invoked for. Message: '" + problemDescriptor.getDescriptionTemplate()+"'.\n" + + "Element' containing file: "+ containingFile +"; context: "+(context == null ? null : context.getContainingFile())+"\n" + +"Inspection invoked for file: "+ myFile +"; context: "+(myContext == null ? null : myContext.getContainingFile())+"\n" + ); } myProblems.add(problemDescriptor); }