Lines 71-76
Link Here
|
71 |
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; |
71 |
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; |
72 |
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; |
72 |
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; |
73 |
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; |
73 |
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; |
|
|
74 |
import org.eclipse.jdt.internal.compiler.problem.ShouldNotImplement; |
74 |
import org.eclipse.jdt.internal.compiler.util.Messages; |
75 |
import org.eclipse.jdt.internal.compiler.util.Messages; |
75 |
import org.eclipse.jdt.internal.compiler.util.Util; |
76 |
import org.eclipse.jdt.internal.compiler.util.Util; |
76 |
|
77 |
|
Lines 568-574
Link Here
|
568 |
contents[contentsOffset++] = methodIndexByte2; |
569 |
contents[contentsOffset++] = methodIndexByte2; |
569 |
attributeNumber++; |
570 |
attributeNumber++; |
570 |
} |
571 |
} |
571 |
if (this.targetJDK >= ClassFileConstants.JDK1_5 && !this.creatingProblemType) { |
572 |
if (this.targetJDK >= ClassFileConstants.JDK1_5) { |
572 |
TypeDeclaration typeDeclaration = referenceBinding.scope.referenceContext; |
573 |
TypeDeclaration typeDeclaration = referenceBinding.scope.referenceContext; |
573 |
if (typeDeclaration != null) { |
574 |
if (typeDeclaration != null) { |
574 |
final Annotation[] annotations = typeDeclaration.annotations; |
575 |
final Annotation[] annotations = typeDeclaration.annotations; |
Lines 828-834
Link Here
|
828 |
contents[contentsOffset++] = (byte) signatureIndex; |
829 |
contents[contentsOffset++] = (byte) signatureIndex; |
829 |
attributesNumber++; |
830 |
attributesNumber++; |
830 |
} |
831 |
} |
831 |
if (this.targetJDK >= ClassFileConstants.JDK1_5 && !this.creatingProblemType) { |
832 |
if (this.targetJDK >= ClassFileConstants.JDK1_5) { |
832 |
FieldDeclaration fieldDeclaration = fieldBinding.sourceField(); |
833 |
FieldDeclaration fieldDeclaration = fieldBinding.sourceField(); |
833 |
if (fieldDeclaration != null) { |
834 |
if (fieldDeclaration != null) { |
834 |
Annotation[] annotations = fieldDeclaration.annotations; |
835 |
Annotation[] annotations = fieldDeclaration.annotations; |
Lines 1024-1030
Link Here
|
1024 |
// always clear the strictfp/native/abstract bit for a problem method |
1025 |
// always clear the strictfp/native/abstract bit for a problem method |
1025 |
generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); |
1026 |
generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); |
1026 |
int methodAttributeOffset = contentsOffset; |
1027 |
int methodAttributeOffset = contentsOffset; |
1027 |
int attributeNumber = generateMethodInfoAttribute(methodBinding, true); |
1028 |
int attributeNumber = generateMethodInfoAttribute(methodBinding); |
1028 |
|
1029 |
|
1029 |
// Code attribute |
1030 |
// Code attribute |
1030 |
attributeNumber++; |
1031 |
attributeNumber++; |
Lines 1109-1115
Link Here
|
1109 |
// always clear the strictfp/native/abstract bit for a problem method |
1110 |
// always clear the strictfp/native/abstract bit for a problem method |
1110 |
generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); |
1111 |
generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); |
1111 |
int methodAttributeOffset = contentsOffset; |
1112 |
int methodAttributeOffset = contentsOffset; |
1112 |
int attributeNumber = generateMethodInfoAttribute(methodBinding, true); |
1113 |
int attributeNumber = generateMethodInfoAttribute(methodBinding); |
1113 |
|
1114 |
|
1114 |
// Code attribute |
1115 |
// Code attribute |
1115 |
attributeNumber++; |
1116 |
attributeNumber++; |
Lines 6033-6045
Link Here
|
6033 |
return constantPool.UTF8Cache.returnKeyFor(2); |
6034 |
return constantPool.UTF8Cache.returnKeyFor(2); |
6034 |
} |
6035 |
} |
6035 |
|
6036 |
|
6036 |
private void generateAnnotation(Annotation annotation, int attributeOffset) { |
6037 |
private void generateAnnotation(Annotation annotation, int currentOffset) { |
|
|
6038 |
int startingContentsOffset = currentOffset; |
6037 |
if (contentsOffset + 4 >= this.contents.length) { |
6039 |
if (contentsOffset + 4 >= this.contents.length) { |
6038 |
resizeContents(4); |
6040 |
resizeContents(4); |
6039 |
} |
6041 |
} |
6040 |
TypeBinding annotationTypeBinding = annotation.resolvedType; |
6042 |
TypeBinding annotationTypeBinding = annotation.resolvedType; |
6041 |
if (annotationTypeBinding == null) { |
6043 |
if (annotationTypeBinding == null) { |
6042 |
this.contentsOffset = attributeOffset; |
6044 |
this.contentsOffset = startingContentsOffset; |
6043 |
return; |
6045 |
return; |
6044 |
} |
6046 |
} |
6045 |
final int typeIndex = constantPool.literalIndex(annotationTypeBinding.signature()); |
6047 |
final int typeIndex = constantPool.literalIndex(annotationTypeBinding.signature()); |
Lines 6062-6070
Link Here
|
6062 |
contents[contentsOffset++] = (byte) elementNameIndex; |
6064 |
contents[contentsOffset++] = (byte) elementNameIndex; |
6063 |
MethodBinding methodBinding = memberValuePair.binding; |
6065 |
MethodBinding methodBinding = memberValuePair.binding; |
6064 |
if (methodBinding == null) { |
6066 |
if (methodBinding == null) { |
6065 |
contentsOffset = attributeOffset; |
6067 |
contentsOffset = startingContentsOffset; |
6066 |
} else { |
6068 |
} else { |
6067 |
generateElementValue(memberValuePair.value, methodBinding.returnType, attributeOffset); |
6069 |
try { |
|
|
6070 |
generateElementValue(memberValuePair.value, methodBinding.returnType, startingContentsOffset); |
6071 |
} catch(ClassCastException e) { |
6072 |
contentsOffset = startingContentsOffset; |
6073 |
} catch(ShouldNotImplement e) { |
6074 |
contentsOffset = startingContentsOffset; |
6075 |
} |
6068 |
} |
6076 |
} |
6069 |
} |
6077 |
} |
6070 |
} else { |
6078 |
} else { |
Lines 6084-6092
Link Here
|
6084 |
contents[contentsOffset++] = (byte) elementNameIndex; |
6092 |
contents[contentsOffset++] = (byte) elementNameIndex; |
6085 |
MethodBinding methodBinding = singleMemberAnnotation.memberValuePairs()[0].binding; |
6093 |
MethodBinding methodBinding = singleMemberAnnotation.memberValuePairs()[0].binding; |
6086 |
if (methodBinding == null) { |
6094 |
if (methodBinding == null) { |
6087 |
contentsOffset = attributeOffset; |
6095 |
contentsOffset = startingContentsOffset; |
6088 |
} else { |
6096 |
} else { |
6089 |
generateElementValue(singleMemberAnnotation.memberValue, methodBinding.returnType, attributeOffset); |
6097 |
try { |
|
|
6098 |
generateElementValue(singleMemberAnnotation.memberValue, methodBinding.returnType, startingContentsOffset); |
6099 |
} catch(ClassCastException e) { |
6100 |
contentsOffset = startingContentsOffset; |
6101 |
} catch(ShouldNotImplement e) { |
6102 |
contentsOffset = startingContentsOffset; |
6103 |
} |
6090 |
} |
6104 |
} |
6091 |
} else { |
6105 |
} else { |
6092 |
// this is a marker annotation (no member value pairs) |
6106 |
// this is a marker annotation (no member value pairs) |
Lines 6290-6300
Link Here
|
6290 |
contentsOffset = attributeOffset; |
6304 |
contentsOffset = attributeOffset; |
6291 |
} |
6305 |
} |
6292 |
} |
6306 |
} |
6293 |
|
|
|
6294 |
public int generateMethodInfoAttribute(MethodBinding methodBinding) { |
6295 |
return generateMethodInfoAttribute(methodBinding, false); |
6296 |
} |
6297 |
|
6298 |
public int generateMethodInfoAttribute(MethodBinding methodBinding, AnnotationMethodDeclaration declaration) { |
6307 |
public int generateMethodInfoAttribute(MethodBinding methodBinding, AnnotationMethodDeclaration declaration) { |
6299 |
int attributesNumber = generateMethodInfoAttribute(methodBinding); |
6308 |
int attributesNumber = generateMethodInfoAttribute(methodBinding); |
6300 |
int attributeOffset = contentsOffset; |
6309 |
int attributeOffset = contentsOffset; |
Lines 6334-6340
Link Here
|
6334 |
* @param methodBinding org.eclipse.jdt.internal.compiler.lookup.MethodBinding |
6343 |
* @param methodBinding org.eclipse.jdt.internal.compiler.lookup.MethodBinding |
6335 |
* @return <CODE>int</CODE> |
6344 |
* @return <CODE>int</CODE> |
6336 |
*/ |
6345 |
*/ |
6337 |
public int generateMethodInfoAttribute(MethodBinding methodBinding, boolean createProblemMethod) { |
6346 |
public int generateMethodInfoAttribute(MethodBinding methodBinding) { |
6338 |
// leave two bytes for the attribute_number |
6347 |
// leave two bytes for the attribute_number |
6339 |
contentsOffset += 2; |
6348 |
contentsOffset += 2; |
6340 |
if (contentsOffset + 2 >= this.contents.length) { |
6349 |
if (contentsOffset + 2 >= this.contents.length) { |
Lines 6459-6465
Link Here
|
6459 |
contents[contentsOffset++] = (byte) signatureIndex; |
6468 |
contents[contentsOffset++] = (byte) signatureIndex; |
6460 |
attributeNumber++; |
6469 |
attributeNumber++; |
6461 |
} |
6470 |
} |
6462 |
if (this.targetJDK >= ClassFileConstants.JDK1_5 && !this.creatingProblemType && !createProblemMethod) { |
6471 |
if (this.targetJDK >= ClassFileConstants.JDK1_5) { |
6463 |
AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod(); |
6472 |
AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod(); |
6464 |
if (methodDeclaration != null) { |
6473 |
if (methodDeclaration != null) { |
6465 |
Annotation[] annotations = methodDeclaration.annotations; |
6474 |
Annotation[] annotations = methodDeclaration.annotations; |
Lines 6607-6614
Link Here
|
6607 |
} |
6616 |
} |
6608 |
} |
6617 |
} |
6609 |
|
6618 |
|
|
|
6619 |
int annotationAttributeOffset = contentsOffset; |
6610 |
if (invisibleAnnotationsCounter != 0) { |
6620 |
if (invisibleAnnotationsCounter != 0) { |
6611 |
int annotationAttributeOffset = contentsOffset; |
|
|
6612 |
if (contentsOffset + 10 >= contents.length) { |
6621 |
if (contentsOffset + 10 >= contents.length) { |
6613 |
resizeContents(10); |
6622 |
resizeContents(10); |
6614 |
} |
6623 |
} |
Lines 6622-6642
Link Here
|
6622 |
int annotationsLengthOffset = contentsOffset; |
6631 |
int annotationsLengthOffset = contentsOffset; |
6623 |
contentsOffset += 2; // leave space for the annotations length |
6632 |
contentsOffset += 2; // leave space for the annotations length |
6624 |
|
6633 |
|
6625 |
contents[annotationsLengthOffset++] = (byte) (invisibleAnnotationsCounter >> 8); |
6634 |
int counter = 0; |
6626 |
contents[annotationsLengthOffset++] = (byte) invisibleAnnotationsCounter; |
|
|
6627 |
|
6628 |
loop: for (int i = 0; i < length; i++) { |
6635 |
loop: for (int i = 0; i < length; i++) { |
6629 |
if (invisibleAnnotationsCounter == 0) break loop; |
6636 |
if (invisibleAnnotationsCounter == 0) break loop; |
6630 |
Annotation annotation = annotations[i]; |
6637 |
Annotation annotation = annotations[i]; |
6631 |
if (isRuntimeInvisible(annotation)) { |
6638 |
if (isRuntimeInvisible(annotation)) { |
6632 |
generateAnnotation(annotation, annotationAttributeOffset); |
6639 |
int currentAnnotationOffset = this.contentsOffset; |
|
|
6640 |
generateAnnotation(annotation, currentAnnotationOffset); |
6633 |
invisibleAnnotationsCounter--; |
6641 |
invisibleAnnotationsCounter--; |
6634 |
if (this.contentsOffset == annotationAttributeOffset) { |
6642 |
if (this.contentsOffset != currentAnnotationOffset) { |
6635 |
break loop; |
6643 |
counter++; |
6636 |
} |
6644 |
} |
6637 |
} |
6645 |
} |
6638 |
} |
6646 |
} |
6639 |
if (contentsOffset != annotationAttributeOffset) { |
6647 |
if (counter != 0) { |
|
|
6648 |
contents[annotationsLengthOffset++] = (byte) (counter >> 8); |
6649 |
contents[annotationsLengthOffset++] = (byte) counter; |
6650 |
|
6640 |
int attributeLength = contentsOffset - attributeLengthOffset - 4; |
6651 |
int attributeLength = contentsOffset - attributeLengthOffset - 4; |
6641 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); |
6652 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); |
6642 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); |
6653 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); |
Lines 6648-6655
Link Here
|
6648 |
} |
6659 |
} |
6649 |
} |
6660 |
} |
6650 |
|
6661 |
|
|
|
6662 |
annotationAttributeOffset = contentsOffset; |
6651 |
if (visibleAnnotationsCounter != 0) { |
6663 |
if (visibleAnnotationsCounter != 0) { |
6652 |
int annotationAttributeOffset = contentsOffset; |
|
|
6653 |
if (contentsOffset + 10 >= contents.length) { |
6664 |
if (contentsOffset + 10 >= contents.length) { |
6654 |
resizeContents(10); |
6665 |
resizeContents(10); |
6655 |
} |
6666 |
} |
Lines 6663-6683
Link Here
|
6663 |
int annotationsLengthOffset = contentsOffset; |
6674 |
int annotationsLengthOffset = contentsOffset; |
6664 |
contentsOffset += 2; // leave space for the annotations length |
6675 |
contentsOffset += 2; // leave space for the annotations length |
6665 |
|
6676 |
|
6666 |
contents[annotationsLengthOffset++] = (byte) (visibleAnnotationsCounter >> 8); |
6677 |
int counter = 0; |
6667 |
contents[annotationsLengthOffset++] = (byte) visibleAnnotationsCounter; |
|
|
6668 |
|
6669 |
loop: for (int i = 0; i < length; i++) { |
6678 |
loop: for (int i = 0; i < length; i++) { |
6670 |
if (visibleAnnotationsCounter == 0) break loop; |
6679 |
if (visibleAnnotationsCounter == 0) break loop; |
6671 |
Annotation annotation = annotations[i]; |
6680 |
Annotation annotation = annotations[i]; |
6672 |
if (isRuntimeVisible(annotation)) { |
6681 |
if (isRuntimeVisible(annotation)) { |
6673 |
visibleAnnotationsCounter--; |
6682 |
visibleAnnotationsCounter--; |
6674 |
generateAnnotation(annotation, annotationAttributeOffset); |
6683 |
int currentAnnotationOffset = this.contentsOffset; |
6675 |
if (this.contentsOffset == annotationAttributeOffset) { |
6684 |
generateAnnotation(annotation, currentAnnotationOffset); |
6676 |
break loop; |
6685 |
if (this.contentsOffset != currentAnnotationOffset) { |
|
|
6686 |
counter++; |
6677 |
} |
6687 |
} |
6678 |
} |
6688 |
} |
6679 |
} |
6689 |
} |
6680 |
if (contentsOffset != annotationAttributeOffset) { |
6690 |
if (counter != 0) { |
|
|
6691 |
contents[annotationsLengthOffset++] = (byte) (counter >> 8); |
6692 |
contents[annotationsLengthOffset++] = (byte) counter; |
6693 |
|
6681 |
int attributeLength = contentsOffset - attributeLengthOffset - 4; |
6694 |
int attributeLength = contentsOffset - attributeLengthOffset - 4; |
6682 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); |
6695 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); |
6683 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); |
6696 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); |
Lines 6717-6722
Link Here
|
6717 |
int attributesNumber = 0; |
6730 |
int attributesNumber = 0; |
6718 |
int annotationAttributeOffset = contentsOffset; |
6731 |
int annotationAttributeOffset = contentsOffset; |
6719 |
if (invisibleParametersAnnotationsCounter != 0) { |
6732 |
if (invisibleParametersAnnotationsCounter != 0) { |
|
|
6733 |
int globalCounter = 0; |
6720 |
if (contentsOffset + 7 >= contents.length) { |
6734 |
if (contentsOffset + 7 >= contents.length) { |
6721 |
resizeContents(7); |
6735 |
resizeContents(7); |
6722 |
} |
6736 |
} |
Lines 6728-6734
Link Here
|
6728 |
contentsOffset += 4; // leave space for the attribute length |
6742 |
contentsOffset += 4; // leave space for the attribute length |
6729 |
|
6743 |
|
6730 |
contents[contentsOffset++] = (byte) argumentsLength; |
6744 |
contents[contentsOffset++] = (byte) argumentsLength; |
6731 |
invisibleLoop: for (int i = 0; i < argumentsLength; i++) { |
6745 |
for (int i = 0; i < argumentsLength; i++) { |
6732 |
if (contentsOffset + 2 >= contents.length) { |
6746 |
if (contentsOffset + 2 >= contents.length) { |
6733 |
resizeContents(2); |
6747 |
resizeContents(2); |
6734 |
} |
6748 |
} |
Lines 6737-6761
Link Here
|
6737 |
contents[contentsOffset++] = (byte) 0; |
6751 |
contents[contentsOffset++] = (byte) 0; |
6738 |
} else { |
6752 |
} else { |
6739 |
final int numberOfInvisibleAnnotations = annotationsCounters[i][INVISIBLE_INDEX]; |
6753 |
final int numberOfInvisibleAnnotations = annotationsCounters[i][INVISIBLE_INDEX]; |
6740 |
contents[contentsOffset++] = (byte) (numberOfInvisibleAnnotations >> 8); |
6754 |
int invisibleAnnotationsOffset = this.contentsOffset; |
6741 |
contents[contentsOffset++] = (byte) numberOfInvisibleAnnotations; |
6755 |
// leave space for number of annotations |
|
|
6756 |
this.contentsOffset += 2; |
6757 |
int counter = 0; |
6742 |
if (numberOfInvisibleAnnotations != 0) { |
6758 |
if (numberOfInvisibleAnnotations != 0) { |
6743 |
Argument argument = arguments[i]; |
6759 |
Argument argument = arguments[i]; |
6744 |
Annotation[] annotations = argument.annotations; |
6760 |
Annotation[] annotations = argument.annotations; |
6745 |
for (int j = 0, max = annotations.length; j < max; j++) { |
6761 |
for (int j = 0, max = annotations.length; j < max; j++) { |
6746 |
Annotation annotation = annotations[j]; |
6762 |
Annotation annotation = annotations[j]; |
6747 |
if (isRuntimeInvisible(annotation)) { |
6763 |
if (isRuntimeInvisible(annotation)) { |
6748 |
generateAnnotation(annotation, annotationAttributeOffset); |
6764 |
int currentAnnotationOffset = this.contentsOffset; |
6749 |
if (contentsOffset == annotationAttributeOffset) { |
6765 |
generateAnnotation(annotation, currentAnnotationOffset); |
6750 |
break invisibleLoop; |
6766 |
if (contentsOffset != currentAnnotationOffset) { |
|
|
6767 |
counter++; |
6768 |
globalCounter++; |
6751 |
} |
6769 |
} |
6752 |
invisibleParametersAnnotationsCounter--; |
6770 |
invisibleParametersAnnotationsCounter--; |
6753 |
} |
6771 |
} |
6754 |
} |
6772 |
} |
6755 |
} |
6773 |
} |
|
|
6774 |
contents[invisibleAnnotationsOffset++] = (byte) (counter >> 8); |
6775 |
contents[invisibleAnnotationsOffset] = (byte) counter; |
6756 |
} |
6776 |
} |
6757 |
} |
6777 |
} |
6758 |
if (contentsOffset != annotationAttributeOffset) { |
6778 |
if (globalCounter != 0) { |
6759 |
int attributeLength = contentsOffset - attributeLengthOffset - 4; |
6779 |
int attributeLength = contentsOffset - attributeLengthOffset - 4; |
6760 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); |
6780 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); |
6761 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); |
6781 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); |
Lines 6763-6772
Link Here
|
6763 |
contents[attributeLengthOffset++] = (byte) attributeLength; |
6783 |
contents[attributeLengthOffset++] = (byte) attributeLength; |
6764 |
attributesNumber++; |
6784 |
attributesNumber++; |
6765 |
} else { |
6785 |
} else { |
|
|
6786 |
// if globalCounter is 0, this means that the code generation for all visible annotations failed |
6766 |
contentsOffset = annotationAttributeOffset; |
6787 |
contentsOffset = annotationAttributeOffset; |
6767 |
} |
6788 |
} |
6768 |
} |
6789 |
} |
6769 |
if (visibleParametersAnnotationsCounter != 0) { |
6790 |
if (visibleParametersAnnotationsCounter != 0) { |
|
|
6791 |
int globalCounter = 0; |
6770 |
if (contentsOffset + 7 >= contents.length) { |
6792 |
if (contentsOffset + 7 >= contents.length) { |
6771 |
resizeContents(7); |
6793 |
resizeContents(7); |
6772 |
} |
6794 |
} |
Lines 6778-6784
Link Here
|
6778 |
contentsOffset += 4; // leave space for the attribute length |
6800 |
contentsOffset += 4; // leave space for the attribute length |
6779 |
|
6801 |
|
6780 |
contents[contentsOffset++] = (byte) argumentsLength; |
6802 |
contents[contentsOffset++] = (byte) argumentsLength; |
6781 |
visibleLoop: for (int i = 0; i < argumentsLength; i++) { |
6803 |
for (int i = 0; i < argumentsLength; i++) { |
6782 |
if (contentsOffset + 2 >= contents.length) { |
6804 |
if (contentsOffset + 2 >= contents.length) { |
6783 |
resizeContents(2); |
6805 |
resizeContents(2); |
6784 |
} |
6806 |
} |
Lines 6787-6811
Link Here
|
6787 |
contents[contentsOffset++] = (byte) 0; |
6809 |
contents[contentsOffset++] = (byte) 0; |
6788 |
} else { |
6810 |
} else { |
6789 |
final int numberOfVisibleAnnotations = annotationsCounters[i][VISIBLE_INDEX]; |
6811 |
final int numberOfVisibleAnnotations = annotationsCounters[i][VISIBLE_INDEX]; |
6790 |
contents[contentsOffset++] = (byte) (numberOfVisibleAnnotations >> 8); |
6812 |
int visibleAnnotationsOffset = this.contentsOffset; |
6791 |
contents[contentsOffset++] = (byte) numberOfVisibleAnnotations; |
6813 |
// leave space for number of annotations |
|
|
6814 |
this.contentsOffset += 2; |
6815 |
int counter = 0; |
6792 |
if (numberOfVisibleAnnotations != 0) { |
6816 |
if (numberOfVisibleAnnotations != 0) { |
6793 |
Argument argument = arguments[i]; |
6817 |
Argument argument = arguments[i]; |
6794 |
Annotation[] annotations = argument.annotations; |
6818 |
Annotation[] annotations = argument.annotations; |
6795 |
for (int j = 0, max = annotations.length; j < max; j++) { |
6819 |
for (int j = 0, max = annotations.length; j < max; j++) { |
6796 |
Annotation annotation = annotations[j]; |
6820 |
Annotation annotation = annotations[j]; |
6797 |
if (isRuntimeVisible(annotation)) { |
6821 |
if (isRuntimeVisible(annotation)) { |
6798 |
generateAnnotation(annotation, annotationAttributeOffset); |
6822 |
int currentAnnotationOffset = this.contentsOffset; |
6799 |
if (contentsOffset == annotationAttributeOffset) { |
6823 |
generateAnnotation(annotation, currentAnnotationOffset); |
6800 |
break visibleLoop; |
6824 |
if (contentsOffset != currentAnnotationOffset) { |
|
|
6825 |
counter++; |
6826 |
globalCounter++; |
6801 |
} |
6827 |
} |
6802 |
visibleParametersAnnotationsCounter--; |
6828 |
visibleParametersAnnotationsCounter--; |
6803 |
} |
6829 |
} |
6804 |
} |
6830 |
} |
6805 |
} |
6831 |
} |
|
|
6832 |
contents[visibleAnnotationsOffset++] = (byte) (counter >> 8); |
6833 |
contents[visibleAnnotationsOffset] = (byte) counter; |
6806 |
} |
6834 |
} |
6807 |
} |
6835 |
} |
6808 |
if (contentsOffset != annotationAttributeOffset) { |
6836 |
if (globalCounter != 0) { |
6809 |
int attributeLength = contentsOffset - attributeLengthOffset - 4; |
6837 |
int attributeLength = contentsOffset - attributeLengthOffset - 4; |
6810 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); |
6838 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); |
6811 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); |
6839 |
contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); |
Lines 6813-6818
Link Here
|
6813 |
contents[attributeLengthOffset++] = (byte) attributeLength; |
6841 |
contents[attributeLengthOffset++] = (byte) attributeLength; |
6814 |
attributesNumber++; |
6842 |
attributesNumber++; |
6815 |
} else { |
6843 |
} else { |
|
|
6844 |
// if globalCounter is 0, this means that the code generation for all visible annotations failed |
6816 |
contentsOffset = annotationAttributeOffset; |
6845 |
contentsOffset = annotationAttributeOffset; |
6817 |
} |
6846 |
} |
6818 |
} |
6847 |
} |