diff --git a/platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java index 3233e3359ea3..1ce0f42443a5 100644 --- a/platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java @@ -15,6 +15,8 @@ */ package com.intellij.openapi.editor.impl; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.ex.MarkupIterator; import com.intellij.openapi.util.Getter; import com.intellij.util.IncorrectOperationException; @@ -42,6 +44,8 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; * User: cdr */ abstract class IntervalTreeImpl extends RedBlackTree implements IntervalTree { + static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.RangeMarkerTree"); + static final boolean DEBUG = LOG.isDebugEnabled() || ApplicationManager.getApplication() != null && (ApplicationManager.getApplication().isUnitTestMode() || ApplicationManager.getApplication().isInternal()); private int keySize; // number of all intervals, counting all duplicates, some of them maybe gced final ReadWriteLock l = new ReentrantReadWriteLock(); @@ -66,7 +70,7 @@ abstract class IntervalTreeImpl extends RedBlackTree< @NotNull private final IntervalTreeImpl myIntervalTree; - public IntervalNode(@NotNull IntervalTreeImpl intervalTree, @NotNull E key, int start, int end) { + IntervalNode(@NotNull IntervalTreeImpl intervalTree, @NotNull E key, int start, int end) { // maxEnd == 0 so to not disrupt existing maxes myIntervalTree = intervalTree; myStart = start; @@ -374,7 +378,9 @@ abstract class IntervalTreeImpl extends RedBlackTree< } private void assertUnderWriteLock() { - assert isAcquired(l.writeLock()) : l.writeLock(); + if (DEBUG) { + assert isAcquired(l.writeLock()) : l.writeLock(); + } } private static boolean isAcquired(@NotNull Lock l) { String s = l.toString(); diff --git a/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java index 14ef8ccc977e..e012f11af497 100644 --- a/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java @@ -17,7 +17,6 @@ package com.intellij.openapi.editor.impl; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.impl.ApplicationInfoImpl; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.ex.PrioritizedDocumentListener; @@ -38,9 +37,6 @@ import java.util.concurrent.atomic.AtomicInteger; * User: cdr */ public class RangeMarkerTree extends IntervalTreeImpl { - private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.RangeMarkerTree"); - private static final boolean DEBUG = LOG.isDebugEnabled() || ApplicationManager.getApplication() != null && (ApplicationManager.getApplication().isUnitTestMode() || ApplicationManager.getApplication().isInternal()); - private final PrioritizedDocumentListener myListener; private final Document myDocument; @@ -159,12 +155,12 @@ public class RangeMarkerTree extends IntervalTreeImpl rangeMarkerTree, - @NotNull T key, - int start, - int end, - boolean greedyToLeft, - boolean greedyToRight) { + RMNode(@NotNull RangeMarkerTree rangeMarkerTree, + @NotNull T key, + int start, + int end, + boolean greedyToLeft, + boolean greedyToRight) { super(rangeMarkerTree, key, start, end); setFlag(EXPAND_TO_LEFT_FLAG, greedyToLeft); setFlag(EXPAND_TO_RIGHT_FLAG, greedyToRight);