addAnnotations(annotationList, list.getMetadata());
if (list.getParent() instanceof FieldDeclaration) {
FieldDeclaration fieldDeclaration = (FieldDeclaration) list.getParent();
addAnnotations(annotationList, fieldDeclaration.getMetadata());
} else if (list.getParent() instanceof TopLevelVariableDeclaration) {
TopLevelVariableDeclaration variableDeclaration = (TopLevelVariableDeclaration) list.getParent();
addAnnotations(annotationList, variableDeclaration.getMetadata());
}
}
if (!annotationList.isEmpty()) {
((ElementImpl) element).setMetadata(annotationList.toArray(new ElementAnnotationImpl[annotationList.size()]));
}