Puts a Runtime[In]Visible[Type]Annotations attribute containing this annotations and all its predecessors (see #previousAnnotation in the given ByteVector. Annotations are put in the same order they have been visited. @param attributeNameIndex the constant pool index of the attribute
(final int attributeNameIndex, final ByteVector output)
| 313 | * @param output where the attribute must be put. |
| 314 | */ |
| 315 | void putAnnotations(final int attributeNameIndex, final ByteVector output) { |
| 316 | int attributeLength = 2; // For num_annotations. |
| 317 | int numAnnotations = 0; |
| 318 | AnnotationWriter annotationWriter = this; |
| 319 | AnnotationWriter firstAnnotation = null; |
| 320 | while (annotationWriter != null) { |
| 321 | // In case the user forgot to call visitEnd(). |
| 322 | annotationWriter.visitEnd(); |
| 323 | attributeLength += annotationWriter.annotation.length; |
| 324 | numAnnotations++; |
| 325 | firstAnnotation = annotationWriter; |
| 326 | annotationWriter = annotationWriter.previousAnnotation; |
| 327 | } |
| 328 | output.putShort(attributeNameIndex); |
| 329 | output.putInt(attributeLength); |
| 330 | output.putShort(numAnnotations); |
| 331 | annotationWriter = firstAnnotation; |
| 332 | while (annotationWriter != null) { |
| 333 | output.putByteArray(annotationWriter.annotation.data, 0, annotationWriter.annotation.length); |
| 334 | annotationWriter = annotationWriter.nextAnnotation; |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | /** |
| 339 | * Returns the size of a Runtime[In]VisibleParameterAnnotations attribute containing all the |
no test coverage detected