void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiAnnotation annotation = ObjectUtils.tryCast(element, PsiAnnotation.class); if (annotation == null) return; String qualifiedName = annotation.getQualifiedName(); if (qualifiedName == null) return; PsiModifierList owner = ObjectUtils.tryCast(annotation.getOwner(), PsiModifierList.class); if (owner == null) return; PsiModifierListOwner member = ObjectUtils.tryCast(owner.getParent(), PsiModifierListOwner.class); PsiTypeElement typeElement = member instanceof PsiMethod method ? method.getReturnTypeElement() : member instanceof PsiVariable variable ? variable.getTypeElement() : null; if (typeElement == null || !(typeElement.getType() instanceof PsiArrayType)) return; PsiAnnotation addedAnnotation = typeElement.addAnnotation(qualifiedName); addedAnnotation.replace(annotation); annotation.delete(); }