private void updateAnnotationTargetInfo(AnnotationInstance[] annotations, ClassInfo clazz) { // Update a method or field internals annotations to reference the class. // This update is possible since annotations on a non-null target are unique and not shared for (AnnotationInstance annotation : annotations) { AnnotationTarget target = annotation.target(); if (target instanceof MethodInfo) { ((MethodInfo)target).setClassInfo(clazz); } else if (target instanceof FieldInfo) { ((FieldInfo)target).setClassInfo(clazz); } } }