List<PsiAnnotation> (@NotNull final PsiModifierListOwner listOwner, @NotNull Iterable<String> annotationNames) { final PsiModifierList list = listOwner.getModifierList(); if (list == null) { return null; } List<PsiAnnotation> result = null; for (PsiAnnotation annotation : list.getAnnotations()) { if (ContainerUtil.exists(annotationNames, annotation::hasQualifiedName) && isApplicableToDeclaration(annotation, list)) { if (result == null) { result = new SmartList<>(); } result.add(annotation); } } return result; }