X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fnative%2Fvm%2Fgnu%2Fjava_lang_reflect_Constructor.c;h=dda0424b546a2f4cbf30d96c68dea21139f6302b;hb=b6fbb1958c8971b06e87ea3c37be0deaff131768;hp=3a82a63aab28b0e2bc8cce0fe2845118083386d2;hpb=910cbf961bf0e79bff9bcb1a9ddc59f5169d5555;p=cacao.git diff --git a/src/native/vm/gnu/java_lang_reflect_Constructor.c b/src/native/vm/gnu/java_lang_reflect_Constructor.c index 3a82a63aa..dda0424b5 100644 --- a/src/native/vm/gnu/java_lang_reflect_Constructor.c +++ b/src/native/vm/gnu/java_lang_reflect_Constructor.c @@ -22,8 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: java_lang_reflect_Constructor.c 8295 2007-08-11 17:57:24Z michi $ - */ @@ -34,6 +32,7 @@ #if defined(ENABLE_ANNOTATIONS) #include "vm/vm.h" +#include "vm/exceptions.h" #endif #include "vm/types.h" @@ -48,8 +47,9 @@ #include "native/include/java_lang_reflect_Constructor.h" #if defined(ENABLE_ANNOTATIONS) -#include "native/include/sun_reflect_ConstantPool.h" -#include "native/vm/reflect.h" +# include "native/include/sun_reflect_ConstantPool.h" + +# include "native/vm/reflect.h" #endif #include "native/vm/java_lang_reflect_Constructor.h" @@ -93,11 +93,11 @@ void _Jv_java_lang_reflect_Constructor_init(void) * Method: constructNative * Signature: ([Ljava/lang/Object;Ljava/lang/Class;I)Ljava/lang/Object; */ -JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_constructNative(JNIEnv *env, java_lang_reflect_Constructor *this, java_objectarray *args, java_lang_Class *declaringClass, s4 slot) +JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_constructNative(JNIEnv *env, java_lang_reflect_Constructor *this, java_handle_objectarray_t *args, java_lang_Class *declaringClass, s4 slot) { /* just to be sure */ - assert(LLNI_field_direct(this, clazz) == declaringClass); + assert(LLNI_field_direct(this, clazz) == LLNI_DIRECT(declaringClass)); assert(LLNI_field_direct(this, slot) == slot); return _Jv_java_lang_reflect_Constructor_newInstance(env, this, args); @@ -110,16 +110,26 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_construct * Method: declaredAnnotations * Signature: ()Ljava/util/Map; */ -JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Constructor_declaredAnnotations(JNIEnv *env, struct java_lang_reflect_Constructor* this) +JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Constructor_declaredAnnotations(JNIEnv *env, java_lang_reflect_Constructor *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; + + LLNI_field_get_ref(this, declaredAnnotations, declaredAnnotations); - if (this == NULL) { - exceptions_throw_nullpointerexception(); - return NULL; + 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; } @@ -128,16 +138,19 @@ JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Constructor_decla * Method: getParameterAnnotations * Signature: ()[[Ljava/lang/annotation/Annotation; */ -JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Constructor_getParameterAnnotations(JNIEnv *env, struct java_lang_reflect_Constructor* this) +JNIEXPORT java_handle_objectarray_t* JNICALL Java_java_lang_reflect_Constructor_getParameterAnnotations(JNIEnv *env, java_lang_reflect_Constructor *this) { - java_handle_t *o = (java_handle_t*)this; + java_handle_bytearray_t *parameterAnnotations = NULL; + int32_t slot = -1; + java_lang_Class *declaringClass = NULL; + classinfo *referer = NULL; - if (this == NULL) { - exceptions_throw_nullpointerexception(); - return NULL; - } + LLNI_field_get_ref(this, parameterAnnotations, parameterAnnotations); + LLNI_field_get_val(this, slot, slot); + LLNI_field_get_ref(this, clazz, declaringClass); + LLNI_class_get(this, referer); - return reflect_get_parameterannotations((java_handle_t*)this->parameterAnnotations, this->slot, this->clazz, o->vftbl->class); + return reflect_get_parameterannotations((java_handle_t*)parameterAnnotations, slot, declaringClass, referer); } #endif