UserMapKeys.updateLombokPresent(targetElement, true);
}
private void addAnnotation(@NotNull PsiModifierListOwner targetElement, @NotNull PsiAnnotation newPsiAnnotation,
@NotNull Class<? extends Annotation> annotationClass) {
final PsiAnnotation presentAnnotation = PsiAnnotationUtil.findAnnotation(targetElement, annotationClass);
final Project project = targetElement.getProject();
final JavaCodeStyleManager javaCodeStyleManager = JavaCodeStyleManager.getInstance(project);
javaCodeStyleManager.shortenClassReferences(newPsiAnnotation);
if (null == presentAnnotation) {
PsiModifierList modifierList = targetElement.getModifierList();
if (null != modifierList) {
modifierList.addAfter(newPsiAnnotation, null);
}
} else {
presentAnnotation.setDeclaredAttributeValue(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME,
newPsiAnnotation.findDeclaredAttributeValue(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME));
}
}