private static void addNewAnnotations(Annotation[] add, CtMethod method, ConstPool constpool, ClassPool classPool, AnnotationsAttribute attr) throws IllegalAccessException, NotFoundException, InvocationTargetException { if (null == attr) { attr = new AnnotationsAttribute(constpool, AnnotationsAttribute.visibleTag); method.getMethodInfo().addAttribute(attr); } for (Annotation toAdd : add) { attr.addAnnotation(toJavassist(toAdd, constpool, classPool)); } }