View | Details | Raw Unified | Return to bug 271561 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/ClassFileInfo.java (+12 lines)
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
}
(-)model/org/eclipse/jdt/internal/core/util/Util.java (+8 lines)
Lines 3098-3103 Link Here
3098
					// values are heterogeneous, value kind is thus unknown
3098
					// values are heterogeneous, value kind is thus unknown
3099
					memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
3099
					memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
3100
				}
3100
				}
3101
				if (value instanceof Annotation) {
3102
					Annotation annotation = (Annotation) value;
3103
					for (int j = 0; j < i; j++) {
3104
						if (annotation.equals(values[j])) {
3105
							annotation.occurrenceCount++;
3106
						}
3107
					}
3108
				}
3101
				values[i] = value;
3109
				values[i] = value;
3102
			}
3110
			}
3103
			if (memberValuePair.valueKind == -1)
3111
			if (memberValuePair.valueKind == -1)

Return to bug 271561