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

Method visit

src/jvm/clojure/asm/AnnotationWriter.java:149–222  ·  view source on GitHub ↗
(final String name, final Object value)

Source from the content-addressed store, hash-verified

147 // -----------------------------------------------------------------------------------------------
148
149 @Override
150 public void visit(final String name, final Object value) {
151 // Case of an element_value with a const_value_index, class_info_index or array_index field.
152 // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.1.
153 ++numElementValuePairs;
154 if (useNamedValues) {
155 annotation.putShort(symbolTable.addConstantUtf8(name));
156 }
157 if (value instanceof String) {
158 annotation.put12('s', symbolTable.addConstantUtf8((String) value));
159 } else if (value instanceof Byte) {
160 annotation.put12('B', symbolTable.addConstantInteger(((Byte) value).byteValue()).index);
161 } else if (value instanceof Boolean) {
162 int booleanValue = ((Boolean) value).booleanValue() ? 1 : 0;
163 annotation.put12('Z', symbolTable.addConstantInteger(booleanValue).index);
164 } else if (value instanceof Character) {
165 annotation.put12('C', symbolTable.addConstantInteger(((Character) value).charValue()).index);
166 } else if (value instanceof Short) {
167 annotation.put12('S', symbolTable.addConstantInteger(((Short) value).shortValue()).index);
168 } else if (value instanceof Type) {
169 annotation.put12('c', symbolTable.addConstantUtf8(((Type) value).getDescriptor()));
170 } else if (value instanceof byte[]) {
171 byte[] byteArray = (byte[]) value;
172 annotation.put12('[', byteArray.length);
173 for (byte byteValue : byteArray) {
174 annotation.put12('B', symbolTable.addConstantInteger(byteValue).index);
175 }
176 } else if (value instanceof boolean[]) {
177 boolean[] booleanArray = (boolean[]) value;
178 annotation.put12('[', booleanArray.length);
179 for (boolean booleanValue : booleanArray) {
180 annotation.put12('Z', symbolTable.addConstantInteger(booleanValue ? 1 : 0).index);
181 }
182 } else if (value instanceof short[]) {
183 short[] shortArray = (short[]) value;
184 annotation.put12('[', shortArray.length);
185 for (short shortValue : shortArray) {
186 annotation.put12('S', symbolTable.addConstantInteger(shortValue).index);
187 }
188 } else if (value instanceof char[]) {
189 char[] charArray = (char[]) value;
190 annotation.put12('[', charArray.length);
191 for (char charValue : charArray) {
192 annotation.put12('C', symbolTable.addConstantInteger(charValue).index);
193 }
194 } else if (value instanceof int[]) {
195 int[] intArray = (int[]) value;
196 annotation.put12('[', intArray.length);
197 for (int intValue : intArray) {
198 annotation.put12('I', symbolTable.addConstantInteger(intValue).index);
199 }
200 } else if (value instanceof long[]) {
201 long[] longArray = (long[]) value;
202 annotation.put12('[', longArray.length);
203 for (long longValue : longArray) {
204 annotation.put12('J', symbolTable.addConstantLong(longValue).index);
205 }
206 } else if (value instanceof float[]) {

Callers

nothing calls this directly

Calls 11

putShortMethod · 0.80
addConstantUtf8Method · 0.80
put12Method · 0.80
addConstantIntegerMethod · 0.80
byteValueMethod · 0.80
shortValueMethod · 0.80
addConstantLongMethod · 0.80
addConstantFloatMethod · 0.80
addConstantDoubleMethod · 0.80
addConstantMethod · 0.80
getDescriptorMethod · 0.45

Tested by

no test coverage detected