PsiAnnotation (@NotNull String fqn, @NotNull PsiNameValuePair @NotNull [] pairs, @NotNull PsiAnnotationOwner owner) { if (owner.hasAnnotation(fqn)) return null; if (owner instanceof PsiModifierList) { PsiElement modListOwner = ((PsiModifierList)owner).getParent(); if (modListOwner instanceof PsiModifierListOwner) { if (ExternalAnnotationsManager.getInstance(modListOwner.getProject()) .findExternalAnnotation((PsiModifierListOwner)modListOwner, fqn) != null) { return null; } PsiTypeElement typeElement = modListOwner instanceof PsiMethod ? ((PsiMethod)modListOwner).getReturnTypeElement() : modListOwner instanceof PsiVariable ? ((PsiVariable)modListOwner).getTypeElement() : null; while (typeElement != null && typeElement.getType() instanceof PsiArrayType) { typeElement = PsiTreeUtil.getChildOfType(typeElement, PsiTypeElement.class); } if (typeElement != null && typeElement.getType().hasAnnotation(fqn)) { return null; } } } return addPhysicalAnnotationTo(expandParameterAndAddAnnotation(owner, fqn), pairs); }