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

Method putFieldInfo

src/jvm/clojure/asm/FieldWriter.java:261–336  ·  view source on GitHub ↗

Puts the content of the field_info JVMS structure generated by this FieldWriter into the given ByteVector. @param output where the field_info structure must be put.

(final ByteVector output)

Source from the content-addressed store, hash-verified

259 * @param output where the field_info structure must be put.
260 */
261 void putFieldInfo(final ByteVector output) {
262 boolean useSyntheticAttribute = symbolTable.getMajorVersion() < Opcodes.V1_5;
263 // Put the access_flags, name_index and descriptor_index fields.
264 int mask = useSyntheticAttribute ? Opcodes.ACC_SYNTHETIC : 0;
265 output.putShort(accessFlags & ~mask).putShort(nameIndex).putShort(descriptorIndex);
266 // Compute and put the attributes_count field.
267 // For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
268 int attributesCount = 0;
269 if (constantValueIndex != 0) {
270 ++attributesCount;
271 }
272 if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && useSyntheticAttribute) {
273 ++attributesCount;
274 }
275 if (signatureIndex != 0) {
276 ++attributesCount;
277 }
278 if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
279 ++attributesCount;
280 }
281 if (lastRuntimeVisibleAnnotation != null) {
282 ++attributesCount;
283 }
284 if (lastRuntimeInvisibleAnnotation != null) {
285 ++attributesCount;
286 }
287 if (lastRuntimeVisibleTypeAnnotation != null) {
288 ++attributesCount;
289 }
290 if (lastRuntimeInvisibleTypeAnnotation != null) {
291 ++attributesCount;
292 }
293 if (firstAttribute != null) {
294 attributesCount += firstAttribute.getAttributeCount();
295 }
296 output.putShort(attributesCount);
297 // Put the field_info attributes.
298 // For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
299 if (constantValueIndex != 0) {
300 output
301 .putShort(symbolTable.addConstantUtf8(Constants.CONSTANT_VALUE))
302 .putInt(2)
303 .putShort(constantValueIndex);
304 }
305 if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && useSyntheticAttribute) {
306 output.putShort(symbolTable.addConstantUtf8(Constants.SYNTHETIC)).putInt(0);
307 }
308 if (signatureIndex != 0) {
309 output
310 .putShort(symbolTable.addConstantUtf8(Constants.SIGNATURE))
311 .putInt(2)
312 .putShort(signatureIndex);
313 }
314 if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
315 output.putShort(symbolTable.addConstantUtf8(Constants.DEPRECATED)).putInt(0);
316 }
317 if (lastRuntimeVisibleAnnotation != null) {
318 lastRuntimeVisibleAnnotation.putAnnotations(

Callers 1

toByteArrayMethod · 0.95

Calls 7

getMajorVersionMethod · 0.80
putShortMethod · 0.80
putIntMethod · 0.80
addConstantUtf8Method · 0.80
putAnnotationsMethod · 0.80
getAttributeCountMethod · 0.45
putAttributesMethod · 0.45

Tested by

no test coverage detected