boolean (@Nullable PsiModifierListOwner owner, @NotNull Collection<String> annotations) { final PsiModifierList modList; if (owner == null || (modList = owner.getModifierList()) == null) return false; List<String> fqns = null; for (String fqn : annotations) { boolean isPattern = fqn.endsWith("*"); if (!isPattern && isAnnotated(owner, fqn, 0)) { return true; } else if (isPattern) { if (fqns == null) { fqns = new ArrayList<>(); final PsiAnnotation[] ownAnnotations = modList.getAnnotations(); for (PsiAnnotation anno : ownAnnotations) { final String qName = anno.getQualifiedName(); if (qName != null) { fqns.add(qName); } } if (fqns.isEmpty()) return false; } fqn = fqn.substring(0, fqn.length() - 2); for (String annoFQN : fqns) { if (annoFQN.startsWith(fqn)) { return true; } } } } return false; }