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 c716b7ea96b8..633d402cafaa 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 @@ -51,7 +51,7 @@ public abstract class IntervalTreeImpl extends RedBla protected static class IntervalNode extends RedBlackTree.Node implements MutableInterval { private volatile int myStart; private volatile int myEnd; - private static final int ATTACHED_TO_TREE_FLAG = 2; // true if the node is inserted to the tree + private static final int ATTACHED_TO_TREE_FLAG = COLOR_FLAG+1; // true if the node is inserted to the tree protected final List> intervals; protected int maxEnd; // max of all intervalEnd()s among all children. protected int delta; // delta of startOffset. getStartOffset() = myStartOffset + Sum of deltas up to root @@ -268,7 +268,7 @@ public abstract class IntervalTreeImpl extends RedBla return myEnd = end; } - private static final int VALID_FLAG = 1; + protected static final int VALID_FLAG = ATTACHED_TO_TREE_FLAG + 1; @Override public boolean isValid() { return isFlagSet(VALID_FLAG); 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 3c77399b0073..b0bf56ec0af7 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 @@ -151,8 +151,8 @@ public class RangeMarkerTree extends IntervalTreeImpl extends IntervalTreeImpl.IntervalNode { - private static final int EXPAND_TO_LEFT_FLAG = 3; - private static final int EXPAND_TO_RIGHT_FLAG = 4; + private static final int EXPAND_TO_LEFT_FLAG = VALID_FLAG+1; + private static final int EXPAND_TO_RIGHT_FLAG = EXPAND_TO_LEFT_FLAG+1; public RMNode(@NotNull RangeMarkerTree rangeMarkerTree, @NotNull T key, diff --git a/platform/core-impl/src/com/intellij/openapi/editor/impl/RedBlackTree.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/RedBlackTree.java index c5151e32a050..6ff5fb91bd17 100644 --- a/platform/core-impl/src/com/intellij/openapi/editor/impl/RedBlackTree.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/RedBlackTree.java @@ -299,7 +299,7 @@ public abstract class RedBlackTree { protected Node parent = null; private volatile byte myFlags; - private static final int COLOR_FLAG = 0; + protected static final int COLOR_FLAG = 0; protected boolean isFlagSet(int flag) { int state = myFlags >> flag; @@ -307,6 +307,7 @@ public abstract class RedBlackTree { } protected void setFlag(int flag, boolean value) { + assert flag < 8; int state = value ? 1 : 0; myFlags = (byte)(myFlags & ~(1 << flag) | state << flag); } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeHighlighterData.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeHighlighterData.java index 409bf3769719..a3e2ec1eb716 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeHighlighterData.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/RangeHighlighterData.java @@ -71,6 +71,7 @@ abstract class RangeHighlighterData { } private void setFlag(@FlagConstant int flag, boolean value) { + assert flag < 8; int state = value ? 1 : 0; myFlags = (byte)(myFlags & ~(1 << flag) | state << flag); }