* Removed all Id tags.
[cacao.git] / src / vmcore / field.c
index 98e29f2a6a6ebaee94f69dfc26c0fe30ca05759d..ef66b82bf77760709b0d23f634946155d29a07cc 100644 (file)
@@ -22,8 +22,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: field.c 8288 2007-08-10 15:12:00Z twisti $
-
 */
 
 
@@ -39,6 +37,7 @@
 
 #include "mm/memory.h"
 
+#include "vm/builtin.h"
 #include "vm/exceptions.h"
 #include "vm/global.h"
 #include "vm/primitive.h"
@@ -385,26 +384,41 @@ void field_free(fieldinfo *f)
 }
 
 
-#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 ************************************************************