Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: reflect.c 8305 2007-08-15 13:49:26Z panzi $
+ $Id: reflect.c 8315 2007-08-15 22:49:20Z panzi $
*/
int32_t slot;
java_bytearray *annotations = NULL;
java_bytearray *parameterAnnotations = NULL;
- annotation_bytearray_t *ba = NULL;
-
-#if defined(ENABLE_ANNOTATIONS)
- /* get annotations */
- ba = method_get_annotations(m);
-
- if (ba != NULL) {
- annotations = builtin_newarray_byte(ba->size);
-
- if (annotations == NULL)
- return NULL;
-
- MCOPY(annotations->data, ba->data, uint8_t, ba->size);
- }
-
- /* get parameter annotations */
- ba = method_get_parameterannotations(m);
-
- if (ba != NULL) {
- parameterAnnotations = builtin_newarray_byte(ba->size);
-
- if (parameterAnnotations == NULL)
- return NULL;
-
- MCOPY(parameterAnnotations->data, ba->data, uint8_t, ba->size);
- }
-#endif
/* get declaring class */
slot = m - c->methods;
+#if defined(ENABLE_ANNOTATIONS)
+ /* get annotations */
+
+ annotations = method_get_annotations(m);
+
+ /* get parameter annotations */
+
+ parameterAnnotations = method_get_parameterannotations(m);
+#endif
+
#if defined(WITH_CLASSPATH_GNU)
LLNI_field_set_cls(rc, clazz , c);
java_lang_reflect_Field *rf;
int32_t slot;
java_bytearray *annotations = NULL;
- annotation_bytearray_t *ba = NULL;
-
-#if defined(ENABLE_ANNOTATIONS)
- /* get annotations */
- ba = field_get_annotations(f);
-
- if (ba != NULL) {
- annotations = builtin_newarray_byte(ba->size);
-
- if (annotations == NULL)
- return NULL;
-
- MCOPY(annotations->data, ba->data, uint8_t, ba->size);
- }
-#endif
/* get declaring class */
slot = f - c->fields;
+#if defined(ENABLE_ANNOTATIONS)
+ /* get annotations */
+
+ annotations = field_get_annotations(f);
+#endif
+
#if defined(WITH_CLASSPATH_GNU)
LLNI_field_set_cls(rf, clazz , c);
java_bytearray *annotations = NULL;
java_bytearray *parameterAnnotations = NULL;
java_bytearray *annotationDefault = NULL;
- annotation_bytearray_t *ba = NULL;
-
-#if defined(ENABLE_ANNOTATIONS)
- /* get annotations */
- ba = method_get_annotations(m);
-
- if (ba != NULL) {
- annotations = builtin_newarray_byte(ba->size);
-
- if (annotations == NULL)
- return NULL;
-
- MCOPY(annotations->data, ba->data, uint8_t, ba->size);
- }
-
- /* get parameter annotations */
- ba = method_get_parameterannotations(m);
-
- if (ba != NULL) {
- parameterAnnotations = builtin_newarray_byte(ba->size);
-
- if (parameterAnnotations == NULL)
- return NULL;
-
- MCOPY(parameterAnnotations->data, ba->data, uint8_t, ba->size);
- }
-
- /* get annotation default value */
- ba = method_get_annotationdefault(m);
-
- if (ba != NULL) {
- annotationDefault = builtin_newarray_byte(ba->size);
-
- if (annotationDefault == NULL)
- return NULL;
-
- MCOPY(annotationDefault->data, ba->data, uint8_t, ba->size);
- }
-#endif
/* get declaring class */
slot = m - c->methods;
+#if defined(ENABLE_ANNOTATIONS)
+ /* get annotations */
+
+ annotations = method_get_annotations(m);
+
+ /* get parameter annotations */
+
+ parameterAnnotations = method_get_parameterannotations(m);
+
+ /* get annotation default value */
+
+ annotationDefault = method_get_annotationdefault(m);
+#endif
+
#if defined(WITH_CLASSPATH_GNU)
LLNI_field_set_cls(rm, clazz , m->class);
#elif defined(WITH_CLASSPATH_SUN)
- LLNI_field_set_cls(rm, clazz , (java_lang_Class *) m->class);
+ LLNI_field_set_cls(rm, clazz , m->class);
/* The name needs to be interned */
/* XXX implement me better! */
- rm->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(m->name));
- rm->parameterTypes = method_get_parametertypearray(m);
- rm->returnType = (java_lang_Class *) method_returntype_get(m);
- rm->exceptionTypes = method_get_exceptionarray(m);
- rm->modifiers = m->flags & ACC_CLASS_REFLECT_MASK;
- rm->slot = slot;
- rm->signature = m->signature ? (java_lang_String *) javastring_new(m->signature) : NULL;
- rm->annotations = annotations;
- rm->parameterAnnotations = parameterAnnotations;
- rm->annotationDefault = annotationDefault;
+ LLNI_field_set_ref(rm, name , _Jv_java_lang_String_intern((java_lang_String *) javastring_new(m->name)));
+ LLNI_field_set_ref(rm, parameterTypes , method_get_parametertypearray(m));
+ LLNI_field_set_cls(rm, returnType , (java_lang_Class *) method_returntype_get(m));
+ LLNI_field_set_ref(rm, exceptionTypes , method_get_exceptionarray(m));
+ LLNI_field_set_val(rm, modifiers , m->flags & ACC_CLASS_REFLECT_MASK);
+ LLNI_field_set_val(rm, slot , slot);
+ LLNI_field_set_ref(rm, signature , m->signature ? (java_lang_String *) javastring_new(m->signature) : NULL);
+ LLNI_field_set_ref(rm, annotations , annotations);
+ LLNI_field_set_ref(rm, parameterAnnotations, parameterAnnotations);
+ LLNI_field_set_ref(rm, annotationDefault , annotationDefault);
#else
# error unknown classpath configuration
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: field.c 8288 2007-08-10 15:12:00Z twisti $
+ $Id: field.c 8315 2007-08-15 22:49:20Z panzi $
*/
#include "mm/memory.h"
+#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/primitive.h"
*******************************************************************************/
-annotation_bytearray_t *field_get_annotations(fieldinfo *f)
+java_bytearray *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];
+ classinfo *c = f->class;
+ int slot = f - c->fields;
+ annotation_bytearray_t *ba = NULL;
+ java_bytearray *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 NULL;
+
+ return annotations;
}
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: method.c 8295 2007-08-11 17:57:24Z michi $
+ $Id: method.c 8315 2007-08-15 22:49:20Z panzi $
*/
*******************************************************************************/
-annotation_bytearray_t *method_get_annotations(methodinfo *m)
+java_bytearray *method_get_annotations(methodinfo *m)
{
- classinfo *c = m->class;
- int slot = m - c->methods;
-
+ classinfo *c = m->class;
+ int slot = m - c->methods;
+ annotation_bytearray_t *ba = NULL;
+ java_bytearray *annotations = NULL;
+
if (c->method_annotations != NULL && c->method_annotations->size > slot) {
- return c->method_annotations->data[slot];
+ ba = c->method_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 NULL;
+
+ return annotations;
}
*******************************************************************************/
-annotation_bytearray_t *method_get_parameterannotations(methodinfo *m)
+java_bytearray *method_get_parameterannotations(methodinfo *m)
{
- classinfo *c = m->class;
- int slot = m - c->methods;
+ classinfo *c = m->class;
+ int slot = m - c->methods;
+ annotation_bytearray_t *ba = NULL;
+ java_bytearray *parameterAnnotations = NULL;
if (c->method_parameterannotations != NULL &&
c->method_parameterannotations->size > slot) {
- return c->method_parameterannotations->data[slot];
+ ba = c->method_parameterannotations->data[slot];
+
+ if (ba != NULL) {
+ parameterAnnotations = builtin_newarray_byte(ba->size);
+
+ if (parameterAnnotations != NULL) {
+ MCOPY(parameterAnnotations->data, ba->data, uint8_t, ba->size);
+ }
+ }
}
-
- return NULL;
+
+ return parameterAnnotations;
}
*******************************************************************************/
-annotation_bytearray_t *method_get_annotationdefault(methodinfo *m)
+java_bytearray *method_get_annotationdefault(methodinfo *m)
{
- classinfo *c = m->class;
- int slot = m - c->methods;
+ classinfo *c = m->class;
+ int slot = m - c->methods;
+ annotation_bytearray_t *ba = NULL;
+ java_bytearray *annotationDefault = NULL;
if (c->method_annotationdefaults != NULL &&
c->method_annotationdefaults->size > slot) {
- return c->method_annotationdefaults->data[slot];
+ ba = c->method_annotationdefaults->data[slot];
+
+ if (ba != NULL) {
+ annotationDefault = builtin_newarray_byte(ba->size);
+
+ if (annotationDefault != NULL) {
+ MCOPY(annotationDefault->data, ba->data, uint8_t, ba->size);
+ }
+ }
}
-
- return NULL;
+
+ return annotationDefault;
}
#endif