GNU header update.
[cacao.git] / src / native / vm / Constructor.c
index 0d5dce2f2465a7ad4f4530de7e826d5c11442874..cf26f54af17b0b802f63395d4a499a7279d56b06 100644 (file)
@@ -1,9 +1,9 @@
-/* nat/Constructor.c -
+/* native/vm/Constructor.c - java/lang/reflect/Constructor
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
-   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
-   P. Tomsich, J. Wenninger
+   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+   Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
 
    Changes: Joseph Wenninger
 
-   $Id: Constructor.c 835 2004-01-04 23:39:36Z twisti $
+   $Id: Constructor.c 1735 2004-12-07 14:33:27Z twisti $
 
 */
 
 
 #include <string.h>
-#include "jni.h"
-#include "builtin.h"
-#include "loader.h"
-#include "native.h"
-#include "tables.h"
-#include "asmpart.h"
-#include "toolbox/loging.h"
-#include "java_lang_Object.h"
-#include "java_lang_Class.h"
-#include "java_lang_reflect_Constructor.h"
+
+#include "native/jni.h"
+#include "native/native.h"
+#include "native/include/java_lang_Class.h"
+#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_reflect_Constructor.h"
+#include "toolbox/logging.h"
+#include "vm/builtin.h"
+#include "vm/exceptions.h"
+#include "vm/loader.h"
+#include "vm/options.h"
+#include "vm/tables.h"
+#include "vm/jit/asmpart.h"
 
 
 /*
  * Method:    newInstance
  * Signature: ([Ljava/lang/Object;)Ljava/lang/Object;
  */
-JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_constructNative(JNIEnv *env, struct java_lang_reflect_Constructor* this, java_objectarray* parameters, struct java_lang_Class* clazz, s4 par3)
+JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_constructNative(JNIEnv *env, java_lang_reflect_Constructor *this, java_objectarray *parameters, java_lang_Class *clazz, s4 par3)
 {
 
+#if defined(__GNUC__)
 #warning fix me for parameters float/double and long long  parameters
+#endif
 
        methodinfo *m;
        java_objectheader *o;
 
-        
-       /*      log_text("Java_java_lang_reflect_Constructor_constructNative called");
-        log_plain_utf(((struct classinfo*)clazz)->name);*/
-/*     log_plain("\n"); */
-
        /* find initializer */
 
        if (!parameters) {
                if (this->parameterTypes->header.size != 0) {
-                       (*env)->ThrowNew(env, loader_load(utf_new_char("java/lang/IllegalArgumentException")), "wrong number of arguments");
+                       *exceptionptr =
+                               new_exception_message(string_java_lang_IllegalArgumentException,
+                                                                         "wrong number of arguments");
                        return 0;
                }
 
        } else {
                if (this->parameterTypes->header.size != parameters->header.size) {
-                       (*env)->ThrowNew(env, loader_load(utf_new_char("java/lang/IllegalArgumentException")), "wrong number of arguments");
+                       *exceptionptr =
+                               new_exception_message(string_java_lang_IllegalArgumentException,
+                                                                         "wrong number of arguments");
                        return 0;
                }
        }
@@ -98,7 +102,7 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_co
                /* && 
                   (m->descriptor == create_methodsig(this->parameterTypes,"V"))))*/
                {
-                       if (verbose) {
+                       if (opt_verbose) {
                                char logtext[MAXLOGTEXT];
                                sprintf(logtext, "Warning: class has no instance-initializer of specified type: ");
                                utf_sprint(logtext + strlen(logtext), ((classinfo *) clazz)->name);
@@ -107,7 +111,9 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_co
                                log_plain("\n");
                                class_showconstantpool((classinfo *) clazz);
                        }
+#if defined(__GNUC__)
 #warning throw an exception here, although this should never happen
+#endif
                        return (java_lang_Object *) o;
                }
 
@@ -128,8 +134,7 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_co
                log_text("Not supported number of arguments in Java_java_lang_reflect_Constructor");
        }
 #endif
-       /*log_plain_utf(m->descriptor);
-         log_text("calling constructor");*/
+
        (void) jni_method_invokeNativeHelper(env, m ,o, parameters); 
 
        return (java_lang_Object *) o;
@@ -141,13 +146,12 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_co
  * Method:    getModifiers
  * Signature: ()I
  */
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Constructor_getModifiers(JNIEnv *env, struct java_lang_reflect_Constructor* this)
+JNIEXPORT s4 JNICALL Java_java_lang_reflect_Constructor_getModifiers(JNIEnv *env, java_lang_reflect_Constructor *this)
 {
-       /*      log_text("Java_java_lang_reflect_Constructor_getModifiers called");*/
        classinfo *c = (classinfo *) (this->clazz);
 
        if ((this->slot < 0) || (this->slot >= c->methodscount))
-               panic("error illegal slot for method in class (getReturnType)");
+               panic("error illegal slot for constructor in class (getModifiers)");
 
        return (c->methods[this->slot]).flags & (ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED);
 }