Lines 57-68
Link Here
|
57 |
private void generateAnnotationInfo(JavaElement parent, HashMap newElements, IBinaryAnnotation annotationInfo) { |
57 |
private void generateAnnotationInfo(JavaElement parent, HashMap newElements, IBinaryAnnotation annotationInfo) { |
58 |
char[] typeName = org.eclipse.jdt.core.Signature.toCharArray(CharOperation.replaceOnCopy(annotationInfo.getTypeName(), '/', '.')); |
58 |
char[] typeName = org.eclipse.jdt.core.Signature.toCharArray(CharOperation.replaceOnCopy(annotationInfo.getTypeName(), '/', '.')); |
59 |
Annotation annotation = new Annotation(parent, new String(typeName)); |
59 |
Annotation annotation = new Annotation(parent, new String(typeName)); |
|
|
60 |
// annotations can be in an array under the same parent annotation |
61 |
while (newElements.containsKey(annotation)) |
62 |
annotation.occurrenceCount++; |
60 |
newElements.put(annotation, annotationInfo); |
63 |
newElements.put(annotation, annotationInfo); |
61 |
IBinaryElementValuePair[] pairs = annotationInfo.getElementValuePairs(); |
64 |
IBinaryElementValuePair[] pairs = annotationInfo.getElementValuePairs(); |
62 |
for (int i = 0, length = pairs.length; i < length; i++) { |
65 |
for (int i = 0, length = pairs.length; i < length; i++) { |
63 |
Object value = pairs[i].getValue(); |
66 |
Object value = pairs[i].getValue(); |
64 |
if (value instanceof IBinaryAnnotation) { |
67 |
if (value instanceof IBinaryAnnotation) { |
65 |
generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) value); |
68 |
generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) value); |
|
|
69 |
} else if (value instanceof Object[]) { |
70 |
// if the value is an array, it can have no more than 1 dimension - no need to recurse |
71 |
Object[] valueArray = (Object[]) value; |
72 |
for (int j = 0, valueArrayLength = valueArray.length; j < valueArrayLength; j++) { |
73 |
Object nestedValue = valueArray[j]; |
74 |
if (nestedValue instanceof IBinaryAnnotation) { |
75 |
generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) nestedValue); |
76 |
} |
77 |
} |
66 |
} |
78 |
} |
67 |
} |
79 |
} |
68 |
} |
80 |
} |