List<XmlTag> (final @NotNull XmlTag tag, final EvaluatedXmlName name, final XmlFile file, boolean processIncludes) { if (!tag.isValid()) { throw new AssertionError("Invalid tag"); } final XmlTag[] tags = tag instanceof XmlTagImpl ? ((XmlTagImpl)tag).getSubTags(processIncludes) : tag.getSubTags(); if (tags.length == 0) { return Collections.emptyList(); } return ContainerUtil.findAll(tags, childTag -> { ProgressManager.checkCanceled(); try { return isNameSuitable(name, childTag, file); } catch (PsiInvalidElementAccessException e) { if (!childTag.isValid()) { LOG.error("tag.getSubTags() returned invalid, " + "tag=" + tag + ", " + "containing file: " + tag.getContainingFile() + "subTag.parent=" + childTag.getNode().getTreeParent()); return false; } throw e; } }); }