void (@NotNull PsiMethod method) { PsiModifierList list = method.getModifierList(); if (myAnnotationsToRemove.length > 0) { for (PsiAnnotation annotation : list.getAnnotations()) { for (String fqn : myAnnotationsToRemove) { if (annotation.hasQualifiedName(fqn)) { annotation.delete(); } } } } list.addAnnotation(myAnnotation); }