Lines 577-608
Link Here
|
577 |
} |
577 |
} |
578 |
|
578 |
|
579 |
private Annotation[] convertAnnotations(IAnnotatable element) throws JavaModelException { |
579 |
private Annotation[] convertAnnotations(IAnnotatable element) throws JavaModelException { |
580 |
char[] cuSource = getSource(); |
|
|
581 |
IAnnotation[] annotations = element.getAnnotations(); |
580 |
IAnnotation[] annotations = element.getAnnotations(); |
582 |
int length = annotations.length; |
581 |
int length = annotations.length; |
583 |
Annotation[] astAnnotations = new Annotation[length]; |
582 |
Annotation[] astAnnotations = new Annotation[length]; |
584 |
int recordedAnnotations = 0; |
583 |
if (length > 0) { |
585 |
for (int i = 0; i < length; i++) { |
584 |
char[] cuSource = getSource(); |
586 |
ISourceRange positions = annotations[i].getSourceRange(); |
585 |
int recordedAnnotations = 0; |
587 |
int start = positions.getOffset(); |
586 |
for (int i = 0; i < length; i++) { |
588 |
int end = start + positions.getLength(); |
587 |
ISourceRange positions = annotations[i].getSourceRange(); |
589 |
char[] annotationSource = CharOperation.subarray(cuSource, start, end); |
588 |
int start = positions.getOffset(); |
590 |
if (annotationSource != null) { |
589 |
int end = start + positions.getLength(); |
591 |
Expression expression = parseMemberValue(annotationSource); |
590 |
char[] annotationSource = CharOperation.subarray(cuSource, start, end); |
592 |
/* |
591 |
if (annotationSource != null) { |
593 |
* expression can be null or not an annotation if the source has changed between |
592 |
Expression expression = parseMemberValue(annotationSource); |
594 |
* the moment where the annotation source positions have been retrieved and the moment were |
593 |
/* |
595 |
* this parsing occurred. |
594 |
* expression can be null or not an annotation if the source has changed between |
596 |
* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=90916 |
595 |
* the moment where the annotation source positions have been retrieved and the moment were |
597 |
*/ |
596 |
* this parsing occurred. |
598 |
if (expression instanceof Annotation) { |
597 |
* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=90916 |
599 |
astAnnotations[recordedAnnotations++] = (Annotation) expression; |
598 |
*/ |
600 |
} |
599 |
if (expression instanceof Annotation) { |
|
|
600 |
astAnnotations[recordedAnnotations++] = (Annotation) expression; |
601 |
} |
602 |
} |
603 |
} |
604 |
if (length != recordedAnnotations) { |
605 |
// resize to remove null annotations |
606 |
System.arraycopy(astAnnotations, 0, (astAnnotations = new Annotation[recordedAnnotations]), 0, recordedAnnotations); |
601 |
} |
607 |
} |
602 |
} |
|
|
603 |
if (length != recordedAnnotations) { |
604 |
// resize to remove null annotations |
605 |
System.arraycopy(astAnnotations, 0, (astAnnotations = new Annotation[recordedAnnotations]), 0, recordedAnnotations); |
606 |
} |
608 |
} |
607 |
return astAnnotations; |
609 |
return astAnnotations; |
608 |
} |
610 |
} |