Reads the element values of a JVMS 'annotation' structure and makes the given visitor visit them. This method can also be used to read the values of the JVMS 'array_value' field of an annotation's 'element_value'. @param annotationVisitor the visitor that must visit the values. @param annotationOff
(
final AnnotationVisitor annotationVisitor,
final int annotationOffset,
final boolean named,
final char[] charBuffer)
| 2740 | * @return the end offset of the JVMS 'annotation' or 'array_value' structure. |
| 2741 | */ |
| 2742 | private int readElementValues( |
| 2743 | final AnnotationVisitor annotationVisitor, |
| 2744 | final int annotationOffset, |
| 2745 | final boolean named, |
| 2746 | final char[] charBuffer) { |
| 2747 | int currentOffset = annotationOffset; |
| 2748 | // Read the num_element_value_pairs field (or num_values field for an array_value). |
| 2749 | int numElementValuePairs = readUnsignedShort(currentOffset); |
| 2750 | currentOffset += 2; |
| 2751 | if (named) { |
| 2752 | // Parse the element_value_pairs array. |
| 2753 | while (numElementValuePairs-- > 0) { |
| 2754 | String elementName = readUTF8(currentOffset, charBuffer); |
| 2755 | currentOffset = |
| 2756 | readElementValue(annotationVisitor, currentOffset + 2, elementName, charBuffer); |
| 2757 | } |
| 2758 | } else { |
| 2759 | // Parse the array_value array. |
| 2760 | while (numElementValuePairs-- > 0) { |
| 2761 | currentOffset = |
| 2762 | readElementValue(annotationVisitor, currentOffset, /* named = */ null, charBuffer); |
| 2763 | } |
| 2764 | } |
| 2765 | if (annotationVisitor != null) { |
| 2766 | annotationVisitor.visitEnd(); |
| 2767 | } |
| 2768 | return currentOffset; |
| 2769 | } |
| 2770 | |
| 2771 | /** |
| 2772 | * Reads a JVMS 'element_value' structure and makes the given visitor visit it. |
no test coverage detected