diagnostics

This commit is contained in:
Alexey Kudravtsev
2009-11-20 12:27:51 +03:00
parent cc73e75166
commit 7675839a1f
2 changed files with 28 additions and 3 deletions
@@ -294,7 +294,7 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase {
if (!canChangeDocumentDuringHighlighting()) {
Document document = getDocument(getFile());
assertTrue(((DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(getProject())).getFileStatusMap().allDirtyScopesAreNull(document));
((DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(getProject())).getFileStatusMap().assertAllDirtyScopesAreNull(document);
}
List<HighlightInfo> infos = DaemonCodeAnalyzerImpl.getHighlights(getEditor().getDocument(), getProject());
@@ -21,15 +21,15 @@ import com.intellij.codeHighlighting.DirtyScopeTrackingHighlightingPassFactory;
import com.intellij.codeHighlighting.Pass;
import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.editor.ex.RangeMarkerEx;
import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.ex.RangeMarkerEx;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.Disposable;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.util.containers.WeakHashMap;
@@ -37,6 +37,7 @@ import gnu.trove.TIntObjectHashMap;
import gnu.trove.TIntObjectProcedure;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -131,6 +132,22 @@ public class FileStatusMap implements Disposable {
}
});
}
@Override
public String toString() {
final StringBuilder s = new StringBuilder();
s.append("defensivelyMarked = " + defensivelyMarked);
s.append("; wolfPassFinfished = " + wolfPassFinfished);
s.append("; errorFound = " + errorFound);
s.append("; dirtyScopes: (");
dirtyScopes.forEachEntry(new TIntObjectProcedure<RangeMarker>() {
public boolean execute(int passId, RangeMarker rangeMarker) {
s.append(" pass: " + passId + " -> " + rangeMarker + ";");
return true;
}
});
return s.toString();
}
}
public void markAllFilesDirty() {
@@ -262,4 +279,12 @@ public class FileStatusMap implements Disposable {
return status != null && !status.defensivelyMarked && status.wolfPassFinfished && status.allDirtyScopesAreNull();
}
}
@TestOnly
public void assertAllDirtyScopesAreNull(@NotNull Document document) {
synchronized (myDocumentToStatusMap) {
FileStatus status = myDocumentToStatusMap.get(document);
assert status != null && !status.defensivelyMarked && status.wolfPassFinfished && status.allDirtyScopesAreNull() : status;
}
}
}