From 00aa44dda5aeba0f670ada3a28df9a788a7eab09 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 3 Feb 2010 13:18:04 +0300 Subject: [PATCH] diagnostics --- .../com/intellij/openapi/editor/impl/RangeMarkerImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeMarkerImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeMarkerImpl.java index 9bb00e2e9ae3..fe0f72a9fb4a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeMarkerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeMarkerImpl.java @@ -37,6 +37,7 @@ public class RangeMarkerImpl extends UserDataHolderBase implements RangeMarkerEx private static final AtomicLong counter = new AtomicLong(); private final long myId; + private volatile int modCount; protected RangeMarkerImpl(@NotNull DocumentEx document, int start, int end) { if (start < 0) { @@ -102,6 +103,7 @@ public class RangeMarkerImpl extends UserDataHolderBase implements RangeMarkerEx } public final void documentChanged(DocumentEvent e) { + int modCount = this.modCount++; int oldStart = myStart; int oldEnd = myEnd; int docLength = myDocument.getTextLength(); @@ -119,7 +121,10 @@ public class RangeMarkerImpl extends UserDataHolderBase implements RangeMarkerEx changedUpdateImpl(e); if (isValid && (myStart > myEnd || myStart < 0 || myEnd > docLength)) { LOG.error("RangeMarker" + (isExpandToLeft ? "[" : "(") + oldStart + ", " + oldEnd + (isExpandToRight ? "]" : ")") + - " update failed. Event = " + e + ". Result[" + myStart + ", " + myEnd + "], doc length=" + docLength + "; "+getClass()); + " update failed. Event = " + e + ". Result[" + myStart + ", " + myEnd + "], " + + "old doc length=" + docLength + "; real doc length = "+myDocument.getTextLength()+ + "; old mod count="+modCount+"; mod count="+this.modCount+ + "; "+getClass()); isValid = false; } }