this.contentsOffset += 2; // leave space for the annotations length
int counter = 0;
loop: for (int i = 0; i < length; i++) {
if (invisibleTypeAnnotationsCounter == 0) break loop;
AnnotationContext annotationContext = annotationContexts[i];
if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
int currentAnnotationOffset = this.contentsOffset;
generateTypeAnnotation(annotationContext, currentAnnotationOffset);
invisibleTypeAnnotationsCounter--;
if (this.contentsOffset != currentAnnotationOffset) {
counter++;
}
}
}
if (counter != 0) {
this.contents[annotationsLengthOffset++] = (byte) (counter >> 8);
this.contents[annotationsLengthOffset++] = (byte) counter;
int attributeLength = this.contentsOffset - attributeLengthOffset - 4;
this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 24);
this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 16);
this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 8);
this.contents[attributeLengthOffset++] = (byte) attributeLength;
attributesNumber++;
} else {
this.contentsOffset = annotationAttributeOffset;
// reset the constant pool to its state before the clinit
this.constantPool.resetForAttributeName(AttributeNamesConstants.RuntimeInvisibleTypeAnnotationsName, constantPoolIndex, constantPOffset);
}
}
annotationAttributeOffset = this.contentsOffset;
constantPOffset = this.constantPool.currentOffset;
constantPoolIndex = this.constantPool.currentIndex;
if (visibleTypeAnnotationsCounter != 0) {
if (this.contentsOffset + 10 >= this.contents.length) {
resizeContents(10);
}
int runtimeVisibleAnnotationsAttributeNameIndex =
this.constantPool.literalIndex(AttributeNamesConstants.RuntimeVisibleTypeAnnotationsName);
this.contents[this.contentsOffset++] = (byte) (runtimeVisibleAnnotationsAttributeNameIndex >> 8);
this.contents[this.contentsOffset++] = (byte) runtimeVisibleAnnotationsAttributeNameIndex;
int attributeLengthOffset = this.contentsOffset;
this.contentsOffset += 4; // leave space for the attribute length
int annotationsLengthOffset = this.contentsOffset;
this.contentsOffset += 2; // leave space for the annotations length
int counter = 0;
loop: for (int i = 0; i < length; i++) {
if (visibleTypeAnnotationsCounter == 0) break loop;
AnnotationContext annotationContext = annotationContexts[i];
if ((annotationContext.visibility & AnnotationContext.VISIBLE) != 0) {
visibleTypeAnnotationsCounter--;
int currentAnnotationOffset = this.contentsOffset;
generateTypeAnnotation(annotationContext, currentAnnotationOffset);
if (this.contentsOffset != currentAnnotationOffset) {