List<PsiAnnotation> (@NotNull PsiModifierListOwner listOwner, @NotNull Collection<String> annotationNames, boolean skipExternal) { List<PsiAnnotation> ownAnnotations = findOwnAnnotations(listOwner, annotationNames); List<PsiAnnotation> nonCodeAnnotations = skipExternal ? null : findNonCodeAnnotations(listOwner, annotationNames); List<PsiAnnotation> annotations = null; if (ownAnnotations != null || nonCodeAnnotations != null) { annotations = new SmartList<>(); if (ownAnnotations != null) { annotations.addAll(ownAnnotations); } if (nonCodeAnnotations != null) { annotations.addAll(nonCodeAnnotations); } } return annotations == null ? Collections.emptyList() : annotations; }