From 3cfde9529e0e287b9769868b01aed0deb8a63846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Tue, 7 Aug 2012 14:21:18 +0200 Subject: [PATCH] cleanup, small optimization in checkDomFile() --- .../util/xml/highlighting/DomElementsInspection.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java index 4691a0a33ca9..d4692d5acc87 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java @@ -107,7 +107,7 @@ public abstract class DomElementsInspection extends XmlSup } /** - * Not intended to be overriden or called by implementors. + * Not intended to be overridden or called by implementors. * Override {@link #checkFileElement(com.intellij.util.xml.DomFileElement, DomElementAnnotationHolder)} (which is preferred) or * {@link #checkDomElement(com.intellij.util.xml.DomElement, DomElementAnnotationHolder, DomHighlightingHelper)} instead. */ @@ -117,6 +117,7 @@ public abstract class DomElementsInspection extends XmlSup for (Class domClass: myDomClasses) { final DomFileElement fileElement = DomManager.getDomManager(file.getProject()).getFileElement((XmlFile)file, domClass); if (fileElement != null) { + //noinspection unchecked return checkDomFile((DomFileElement)fileElement, manager, isOnTheFly); } } @@ -134,15 +135,17 @@ public abstract class DomElementsInspection extends XmlSup } /** - * not intended to be overriden or called by implementors + * not intended to be overridden or called by implementors */ @Nullable protected ProblemDescriptor[] checkDomFile(@NotNull final DomFileElement domFileElement, @NotNull final InspectionManager manager, - final boolean isOnTheFly) { + @SuppressWarnings("UnusedParameters") final boolean isOnTheFly) { final DomElementAnnotationsManager annotationsManager = DomElementAnnotationsManager.getInstance(manager.getProject()); final List list = annotationsManager.checkFileElement(domFileElement, this); + if (list.isEmpty()) return ProblemDescriptor.EMPTY_ARRAY; + List problems = ContainerUtil.concat(list, new Function>() { public Collection fun(final DomElementProblemDescriptor s) {