void (@NotNull PsiModifierListOwner targetElement, String annotationClassName) { final PsiAnnotation psiAnnotation = PsiAnnotationSearchUtil.findAnnotation(targetElement, annotationClassName); if (null != psiAnnotation) { boolean hasOnlyDefaultValues = true; final PsiAnnotationParameterList psiAnnotationParameterList = psiAnnotation.getParameterList(); for (PsiNameValuePair nameValuePair : psiAnnotationParameterList.getAttributes()) { if (null != psiAnnotation.findDeclaredAttributeValue(nameValuePair.getName())) { hasOnlyDefaultValues = false; break; } } if (hasOnlyDefaultValues) { psiAnnotation.delete(); } } }