mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
more defined dom assertions (EA-38729)
This commit is contained in:
@@ -228,7 +228,9 @@ public class DomUtil {
|
||||
if (!attribute.isValid()) {
|
||||
throw new AssertionError("Invalid attr: parent.valid=" + tag.isValid());
|
||||
}
|
||||
ContainerUtil.addIfNotNull(domManager.getDomElement(attribute), result);
|
||||
GenericAttributeValue element = domManager.getDomElement(attribute);
|
||||
checkHasXml(attribute, element);
|
||||
ContainerUtil.addIfNotNull(element, result);
|
||||
}
|
||||
}
|
||||
if (tags) {
|
||||
@@ -236,7 +238,9 @@ public class DomUtil {
|
||||
if (!subTag.isValid()) {
|
||||
throw new AssertionError("Invalid subtag: parent.valid=" + tag.isValid());
|
||||
}
|
||||
ContainerUtil.addIfNotNull(domManager.getDomElement(subTag), result);
|
||||
DomElement element = domManager.getDomElement(subTag);
|
||||
checkHasXml(subTag, element);
|
||||
ContainerUtil.addIfNotNull(element, result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -244,6 +248,12 @@ public class DomUtil {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private static void checkHasXml(XmlElement psi, DomElement dom) {
|
||||
if (dom != null && dom.getXmlElement() == null) {
|
||||
throw new AssertionError("No xml for dom " + dom + "; attr=" + psi + ", physical=" + psi.isPhysical());
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> List<T> getDefinedChildrenOfType(@NotNull final DomElement parent, final Class<T> type, boolean tags, boolean attributes) {
|
||||
return ContainerUtil.findAll(getDefinedChildren(parent, tags, attributes), type);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public abstract class DomElementsInspection<T extends DomElement> extends XmlSup
|
||||
for (final DomElement child : DomUtil.getDefinedChildren(element, true, true)) {
|
||||
final XmlElement element1 = child.getXmlElement();
|
||||
if (element1 == null) {
|
||||
LOG.error("child=" + child + "; parent=" + element);
|
||||
LOG.error("child=" + child + " of class " + child.getClass() + "; parent=" + element);
|
||||
}
|
||||
if (element1.isPhysical()) {
|
||||
visitor.consume(child);
|
||||
|
||||
Reference in New Issue
Block a user