private void addMethodParameterAnnotation(final CtMethod ctMethod, final Annotation[][] parameterAnnotations) {
MethodInfo methodInfo = ctMethod.getMethodInfo();
ParameterAnnotationsAttribute attribute = (ParameterAnnotationsAttribute) methodInfo
.getAttribute(ParameterAnnotationsAttribute.visibleTag);
if (attribute == null) {
attribute = new ParameterAnnotationsAttribute(getConstPool(), ParameterAnnotationsAttribute.visibleTag);
}
List<javassist.bytecode.annotation.Annotation[]> result = CollectionFactory.newList();
for (Annotation[] next : parameterAnnotations)
{
List<javassist.bytecode.annotation.Annotation> list = CollectionFactory.newList();
for (Annotation annotation : next)
{
final javassist.bytecode.annotation.Annotation copy = toJavassistAnnotation(annotation);
list.add(copy);
}
result.add(list.toArray(new javassist.bytecode.annotation.Annotation[]{}));
}
javassist.bytecode.annotation.Annotation[][] annotations = result.toArray(new javassist.bytecode.annotation.Annotation[][]{});
attribute.setAnnotations(annotations);
methodInfo.addAttribute(attribute);
}