void (@NotNull PsiModifierList source, @NotNull PsiModifierList target, String... skipAnnotations) { for (PsiAnnotation annotation : source.getAnnotations()) { PsiJavaCodeReferenceElement ref = annotation.getNameReferenceElement(); if (ref == null) continue; PsiClass oldClass = ObjectUtils.tryCast(ref.resolve(), PsiClass.class); if (oldClass == null) continue; String qualifiedName = oldClass.getQualifiedName(); if (qualifiedName == null || ArrayUtil.contains(qualifiedName, skipAnnotations) || target.hasAnnotation(qualifiedName)) { continue; } PsiClass newClass = JavaPsiFacade.getInstance(target.getProject()).findClass(qualifiedName, target.getResolveScope()); if (newClass == null || !oldClass.getManager().areElementsEquivalent(oldClass, newClass)) continue; AddAnnotationPsiFix.addPhysicalAnnotationIfAbsent(qualifiedName, annotation.getParameterList().getAttributes(), target); } }