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 |
while (newElements.containsKey(annotation)) { |
61 |
annotation.occurrenceCount++; |
62 |
} |
63 |
newElements.put(annotation, annotationInfo); |
64 |
IBinaryElementValuePair[] pairs = annotationInfo.getElementValuePairs(); |
65 |
for (int i = 0, length = pairs.length; i < length; i++) { |
66 |
Object value = pairs[i].getValue(); |
67 |
if (value instanceof IBinaryAnnotation) { |
68 |
generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) value, new String(pairs[i].getName())); |
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, new String(pairs[i].getName())); |
76 |
} |
77 |
} |
78 |
} |
79 |
} |
80 |
} |
81 |
private void generateAnnotationInfo(JavaElement parent, HashMap newElements, IBinaryAnnotation annotationInfo, String memberName) { |
82 |
char[] typeName = org.eclipse.jdt.core.Signature.toCharArray(CharOperation.replaceOnCopy(annotationInfo.getTypeName(), '/', '.')); |
83 |
Annotation annotation = new Annotation(parent, new String(typeName)); |
84 |
annotation.memberValueName = memberName; |
85 |
while (newElements.containsKey(annotation)) { |
86 |
annotation.occurrenceCount++; |
87 |
} |
60 |
newElements.put(annotation, annotationInfo); |
88 |
newElements.put(annotation, annotationInfo); |
61 |
IBinaryElementValuePair[] pairs = annotationInfo.getElementValuePairs(); |
89 |
IBinaryElementValuePair[] pairs = annotationInfo.getElementValuePairs(); |
62 |
for (int i = 0, length = pairs.length; i < length; i++) { |
90 |
for (int i = 0, length = pairs.length; i < length; i++) { |
63 |
Object value = pairs[i].getValue(); |
91 |
Object value = pairs[i].getValue(); |
64 |
if (value instanceof IBinaryAnnotation) { |
92 |
if (value instanceof IBinaryAnnotation) { |
65 |
generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) value); |
93 |
generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) value, new String(pairs[i].getName())); |
|
|
94 |
} else if (value instanceof Object[]) { |
95 |
// if the value is an array, it can have no more than 1 dimension - no need to recurse |
96 |
Object[] valueArray = (Object[]) value; |
97 |
for (int j = 0, valueArrayLength = valueArray.length; j < valueArrayLength; j++) { |
98 |
Object nestedValue = valueArray[j]; |
99 |
if (nestedValue instanceof IBinaryAnnotation) { |
100 |
generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) nestedValue, new String(pairs[i].getName())); |
101 |
} |
102 |
} |
66 |
} |
103 |
} |
67 |
} |
104 |
} |
68 |
} |
105 |
} |