* src/cacaoh/dummy.c (array_objectarray_element_set): Fixed for handles.
[cacao.git] / src / native / vm / gnu / java_lang_reflect_Method.c
index fc916c985a0e5c902591a08e3bae463a987872bc..6e0e5784c066172244ee982b92311f68ebfd19f5 100644 (file)
@@ -22,8 +22,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_reflect_Method.c 8393 2007-08-22 01:10:09Z panzi $
-
 */
 
 
@@ -46,6 +44,7 @@
 #include "native/include/java_lang_String.h"
 
 #if defined(ENABLE_ANNOTATIONS)
+#include "native/include/java_util_Map.h"
 #include "native/include/sun_reflect_ConstantPool.h"
 #include "native/vm/reflect.h"
 #endif
@@ -186,7 +185,7 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Method_invokeNative(J
 {
        /* just to be sure */
 
-       assert(LLNI_field_direct(this, clazz) == clazz);
+       assert(LLNI_field_direct(this, clazz) == LLNI_DIRECT(clazz));
        assert(LLNI_field_direct(this, slot)  == slot);
 
        return _Jv_java_lang_reflect_Method_invoke(this, o, args);
@@ -227,11 +226,11 @@ JNIEXPORT java_lang_String* JNICALL Java_java_lang_reflect_Method_getSignature(J
  */
 JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Method_getDefaultValue(JNIEnv *env, struct java_lang_reflect_Method* this)
 {
+       java_handle_bytearray_t  *annotationDefault          = NULL;
        static methodinfo        *m_parseAnnotationDefault   = NULL;
        utf                      *utf_parseAnnotationDefault = NULL;
        utf                      *utf_desc        = NULL;
        sun_reflect_ConstantPool *constantPool    = NULL;
-       java_handle_t            *o               = (java_handle_t*)this;
        java_lang_Class          *constantPoolOop = NULL;
        classinfo                *referer         = NULL;
 
@@ -279,9 +278,11 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Method_getDefa
                }
        }
 
+       LLNI_field_get_ref(this, annotationDefault, annotationDefault);
+
        return (java_lang_Object*)vm_call_method(
                m_parseAnnotationDefault, NULL,
-               this, this->annotationDefault, constantPool);
+               this, annotationDefault, constantPool);
 }
 
 
@@ -292,8 +293,7 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Method_getDefa
  */
 JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Method_declaredAnnotations(JNIEnv *env, java_lang_reflect_Method *this)
 {
-       java_handle_t           *o                   = (java_handle_t*)this;
-       struct java_util_Map    *declaredAnnotations = NULL;
+       java_util_Map           *declaredAnnotations = NULL;
        java_handle_bytearray_t *annotations         = NULL;
        java_lang_Class         *declaringClass      = NULL;
        classinfo               *referer             = NULL;
@@ -301,13 +301,13 @@ JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Method_declaredAn
        LLNI_field_get_ref(this, declaredAnnotations, declaredAnnotations);
 
        if (declaredAnnotations == NULL) {
-               LLNI_field_get_val(this, annotations, annotations);
+               LLNI_field_get_ref(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);
+               LLNI_field_set_ref(this, declaredAnnotations, (java_handle_t*) declaredAnnotations);
        }
 
        return declaredAnnotations;
@@ -321,7 +321,6 @@ JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Method_declaredAn
  */
 JNIEXPORT java_handle_objectarray_t* JNICALL Java_java_lang_reflect_Method_getParameterAnnotations(JNIEnv *env, java_lang_reflect_Method *this)
 {
-       java_handle_t           *o                    = (java_handle_t*)this;
        java_handle_bytearray_t *parameterAnnotations = NULL;
        int32_t                  slot                 = -1;
        java_lang_Class         *declaringClass       = NULL;