List<PsiAnnotation> (PsiAnnotation annotation, PsiNameValuePair attribute) { PsiAnnotationOwner owner = annotation.getOwner(); String name = annotation.getQualifiedName(); if (owner == null || name == null) { return Collections.emptyList(); } List<PsiAnnotation> annotations = new ArrayList<>(); for (PsiAnnotation other : owner.getAnnotations()) { if (name.equals(other.getQualifiedName())) { PsiNameValuePair[] otherAttributes = other.getParameterList().getAttributes(); if (otherAttributes.length == 1) { PsiNameValuePair otherAttribute = otherAttributes[0]; if (otherAttribute.getAttributeName().equals(attribute.getAttributeName())) { annotations.add(other); } } } } return annotations; }