diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java index dc7ada986a01..adc993471f88 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java @@ -76,24 +76,35 @@ public abstract class DomAnchorImpl implements DomAnchor(parentAnchor, description, index); } - private static void diagnoseNegativeIndex(T t, - DomElement parent, - AbstractDomChildrenDescription description, - List values) { + private static void diagnoseNegativeIndex2(T t, + DomElement parent, + AbstractDomChildrenDescription description, + List values) { final XmlTag parentTag = parent.getXmlTag(); StringBuilder diag = new StringBuilder("Index<0: description=" + description + "\nparent=" + parent + "\nt=" + t + "\nvalues=" + values + "\n"); - for (DomElement value : values) { + for (int i = 0, size = values.size(); i < size; i++) { + DomElement value = values.get(i); if (value.toString().equals(t.toString())) { - diag.append(" hasSame, same=" + (value == t) + + final XmlElement tElement = t.getXmlElement(); + final XmlElement valElement = value.getXmlElement(); + diag.append(" hasSame, i=" + i + + "; same=" + (value == t) + ", equal=" + value.equals(t) + ", equal2=" + t.equals(value) + - ", sameElements=" + (t.getXmlElement() == value.getXmlElement()) + + ", t.physical=" + (tElement == null ? "null" : String.valueOf(tElement.isPhysical())) + + ", value.physical=" + (valElement == null ? "null" : String.valueOf(valElement.isPhysical())) + + ", sameElements=" + (tElement == value.getXmlElement()) + "\n"); + if (tElement != null && valElement != null) { + diag.append(" sameFile=" + (tElement.getContainingFile() == valElement.getContainingFile()) + + ", sameParent=" + (tElement.getParent() == valElement.getParent()) + + "\n"); + } } } @@ -106,7 +117,7 @@ public abstract class DomAnchorImpl implements DomAnchor= totalCount) { return null;