MCPcopy Index your code
hub / github.com/clojure/clojure / visitArray

Method visitArray

src/jvm/clojure/asm/AnnotationWriter.java:250–267  ·  view source on GitHub ↗
(final String name)

Source from the content-addressed store, hash-verified

248 }
249
250 @Override
251 public AnnotationVisitor visitArray(final String name) {
252 // Case of an element_value with an array_value field.
253 // https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.1
254 ++numElementValuePairs;
255 if (useNamedValues) {
256 annotation.putShort(symbolTable.addConstantUtf8(name));
257 }
258 // Write tag, and reserve 2 bytes for num_values. Here we take advantage of the fact that the
259 // end of an element_value of array type is similar to the end of an 'annotation' structure: an
260 // unsigned short num_values followed by num_values element_value, versus an unsigned short
261 // num_element_value_pairs, followed by num_element_value_pairs { element_name_index,
262 // element_value } tuples. This allows us to use an AnnotationWriter with unnamed values to
263 // visit the array elements. Its num_element_value_pairs will correspond to the number of array
264 // elements and will be stored in what is in fact num_values.
265 annotation.put12('[', 0);
266 return new AnnotationWriter(symbolTable, /* useNamedValues = */ false, annotation, null);
267 }
268
269 @Override
270 public void visitEnd() {

Callers 1

readElementValueMethod · 0.45

Calls 3

putShortMethod · 0.80
addConstantUtf8Method · 0.80
put12Method · 0.80

Tested by

no test coverage detected