Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Field.c 8291 2007-08-11 10:43:45Z twisti $
-
*/
return NULL;
}
- if (builtin_instanceof((java_objectheader *) o, c))
+ if (builtin_instanceof((java_handle_t *) o, c))
return (void *) (((intptr_t) o) + f->offset);
}
if (!resolve_class_from_typedesc(desc, true, false, &ret))
return NULL;
- return (java_lang_Class *) ret;
+ return LLNI_classinfo_wrap(ret);
}
void *addr;
int32_t slot;
imm_union value;
- java_objectheader *o;
+ java_handle_t *o;
LLNI_field_get_cls(this, clazz, c);
LLNI_field_get_val(this, slot , slot);
break;
case TYPE_ADR:
- return (java_lang_Object *) *((java_objectheader **) addr);
+#warning this whole thing needs to be inside a critical section!
+ return (java_lang_Object *) *((java_handle_t **) addr);
}
/* Now box the primitive types. */
/* check if value is an instance of the destination class */
/* XXX TODO */
- /* if (!builtin_instanceof((java_objectheader *) value, df->class)) */
+ /* if (!builtin_instanceof((java_handle_t *) value, df->class)) */
/* break; */
*((java_lang_Object **) faddr) = value;
*/
JNIEXPORT java_lang_String* JNICALL Java_java_lang_reflect_Field_getSignature(JNIEnv *env, java_lang_reflect_Field* this)
{
- classinfo *c;
- fieldinfo *f;
- java_objectheader *o;
- int32_t slot;
+ classinfo *c;
+ fieldinfo *f;
+ java_handle_t *o;
+ int32_t slot;
/* get the class and the field */
* Method: declaredAnnotations
* Signature: ()Ljava/util/Map;
*/
-JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Field_declaredAnnotations(JNIEnv *env, struct java_lang_reflect_Field* this)
+JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Field_declaredAnnotations(JNIEnv *env, java_lang_reflect_Field *this)
{
- java_objectheader *o = (java_objectheader*)this;
+ java_handle_t *o = (java_handle_t*)this;
+ struct java_util_Map *declaredAnnotations = NULL;
+ java_handle_bytearray_t *annotations = NULL;
+ java_lang_Class *declaringClass = NULL;
+ classinfo *referer = NULL;
- if (this == NULL) {
- exceptions_throw_nullpointerexception();
- return NULL;
+ LLNI_field_get_ref(this, declaredAnnotations, declaredAnnotations);
+
+ if (declaredAnnotations == NULL) {
+ LLNI_field_get_val(this, annotations, annotations);
+ LLNI_field_get_ref(this, clazz, declaringClass);
+ LLNI_class_get(this, referer);
+
+ declaredAnnotations = reflect_get_declaredannotatios(annotations, declaringClass, referer);
+
+ LLNI_field_set_ref(this, declaredAnnotations, declaredAnnotations);
}
- return reflect_get_declaredannotatios(&(this->declaredAnnotations), this->annotations, this->clazz, o->vftbl->class);
+ return declaredAnnotations;
}
#endif