Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: field.c 8288 2007-08-10 15:12:00Z twisti $
-
*/
#include "mm/memory.h"
+#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/primitive.h"
}
-#if defined(ENABLE_ANNOTATIONS)
/* field_get_annotations ******************************************************
Gets a fields' annotations (or NULL if none).
*******************************************************************************/
-annotation_bytearray_t *field_get_annotations(fieldinfo *f)
+java_handle_bytearray_t *field_get_annotations(fieldinfo *f)
{
- classinfo *c = f->class;
- int slot = f - c->fields;
-
- if (c->field_annotations != NULL &&
- c->field_annotations->size > slot) {
- return c->field_annotations->data[slot];
+#if defined(ENABLE_ANNOTATIONS)
+ classinfo *c;
+ int slot;
+ annotation_bytearray_t *ba;
+ java_handle_bytearray_t *annotations;
+
+ c = f->class;
+ slot = f - c->fields;
+ annotations = NULL;
+
+ if (c->field_annotations != NULL && c->field_annotations->size > slot) {
+ ba = c->field_annotations->data[slot];
+
+ if (ba != NULL) {
+ annotations = builtin_newarray_byte(ba->size);
+
+ if (annotations != NULL) {
+ MCOPY(annotations->data, ba->data, uint8_t, ba->size);
+ }
+ }
}
-
+
+ return annotations;
+#else
return NULL;
-}
#endif
+}
/* field_printflags ************************************************************