public void updateAnnotations(AnnotationTargetSource annotationTargetSource, List<Annotation> annotations, ClassTypeResolver classTypeResolver) throws Exception { List<AnnotationSource<?>> currentAnnotations = annotationTargetSource.getAnnotations(); if (currentAnnotations != null) { for (AnnotationSource<?> currentAnnotation : currentAnnotations) { annotationTargetSource.removeAnnotation(currentAnnotation); } } if (annotations != null) { for (Annotation annotation : annotations) { addAnnotation(annotationTargetSource, annotation); } } }