From fba94c291ee424dfe95bb42ef94ab6e9a9cc5023 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 27 Oct 2005 17:11:35 +0400 Subject: [PATCH] performance optimization --- .../impl/analysis/AnnotationsHighlightUtil.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/codeInsight/impl/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java b/codeInsight/impl/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java index 8d33bcbff2b1..229f2bb51c14 100644 --- a/codeInsight/impl/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java +++ b/codeInsight/impl/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java @@ -13,9 +13,7 @@ import com.intellij.util.containers.HashSet; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; +import java.util.*; /** * @author ven @@ -113,7 +111,7 @@ public class AnnotationsHighlightUtil { } String description = JavaErrorMessages.message("annotation.incompatible.types", - HighlightUtil.formatType(type), HighlightUtil.formatType(expectedType)); + HighlightUtil.formatType(type), HighlightUtil.formatType(expectedType)); return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, value, description); } @@ -121,13 +119,13 @@ public class AnnotationsHighlightUtil { return null; } - public static HighlightInfo[] checkDuplicatedAnnotations(PsiModifierList list) { + public static Collection checkDuplicatedAnnotations(PsiModifierList list) { List result = new ArrayList(); Set refInterfaces = new HashSet(); PsiAnnotation[] annotations = list.getAnnotations(); for (PsiAnnotation annotation : annotations) { PsiJavaCodeReferenceElement nameRef = annotation.getNameReferenceElement(); - if (nameRef == null) return HighlightInfo.EMPTY_ARRAY; + if (nameRef == null) return Collections.EMPTY_LIST; PsiClass aClass = (PsiClass)nameRef.resolve(); if (aClass != null) { if (refInterfaces.contains(aClass)) { @@ -139,7 +137,7 @@ public class AnnotationsHighlightUtil { } } - return result.toArray(new HighlightInfo[result.size()]); + return result; } @Nullable @@ -200,7 +198,7 @@ public class AnnotationsHighlightUtil { public static HighlightInfo checkValidAnnotationType(final PsiTypeElement typeElement) { PsiType type = typeElement.getType(); - if (type != null && !type.accept(new PsiTypeVisitor() { + if (!type.accept(new PsiTypeVisitor() { public Boolean visitType(PsiType type) { return Boolean.FALSE; }