1 /* src/native/vm/gnu/java_lang_reflect_Constructor.c
3 Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 $Id: java_lang_reflect_Constructor.c 7720 2007-04-16 15:49:09Z twisti $
37 #include "native/jni.h"
38 #include "native/native.h"
39 #include "native/include/java_lang_Class.h"
40 #include "native/include/java_lang_Object.h"
41 #include "native/include/java_lang_String.h"
42 #include "native/include/java_lang_reflect_Constructor.h"
44 #include "toolbox/logging.h"
46 #include "vm/builtin.h"
47 #include "vm/exceptions.h"
48 #include "vm/access.h"
49 #include "vm/stringlocal.h"
51 #include "vmcore/class.h"
52 #include "vmcore/method.h"
56 * Class: java/lang/reflect/Constructor
57 * Method: getModifiersInternal
60 JNIEXPORT s4 JNICALL Java_java_lang_reflect_Constructor_getModifiersInternal(JNIEnv *env, java_lang_reflect_Constructor *this)
65 c = (classinfo *) (this->clazz);
66 m = &(c->methods[this->slot]);
73 * Class: java/lang/reflect/Constructor
74 * Method: getParameterTypes
75 * Signature: ()[Ljava/lang/Class;
77 JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Constructor_getParameterTypes(JNIEnv *env, java_lang_reflect_Constructor *this)
82 c = (classinfo *) this->clazz;
83 m = &(c->methods[this->slot]);
85 return method_get_parametertypearray(m);
90 * Class: java/lang/reflect/Constructor
91 * Method: getExceptionTypes
92 * Signature: ()[Ljava/lang/Class;
94 JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Constructor_getExceptionTypes(JNIEnv *env, java_lang_reflect_Constructor *this)
99 c = (classinfo *) this->clazz;
100 m = &(c->methods[this->slot]);
102 return method_get_exceptionarray(m);
107 * Class: java/lang/reflect/Constructor
108 * Method: constructNative
109 * Signature: ([Ljava/lang/Object;)Ljava/lang/Object;
111 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)
115 java_objectheader *o;
117 c = (classinfo *) declaringClass;
118 m = &(c->methods[this->slot]);
120 /* check method access */
122 /* check if we should bypass security checks (AccessibleObject) */
124 if (this->flag == false) {
125 if (!access_check_member(c, m->flags, 1))
136 /* call initializer */
138 (void) _Jv_jni_invokeNative(m, o, args);
140 return (java_lang_Object *) o;
145 * Class: java/lang/reflect/Constructor
146 * Method: getSignature
147 * Signature: ()Ljava/lang/String;
149 JNIEXPORT java_lang_String* JNICALL Java_java_lang_reflect_Constructor_getSignature(JNIEnv *env, java_lang_reflect_Constructor *this)
153 java_objectheader *o;
155 c = (classinfo *) this->clazz;
156 m = &(c->methods[this->slot]);
158 if (m->signature == NULL)
161 o = javastring_new(m->signature);
163 /* in error case o is NULL */
165 return (java_lang_String *) o;
170 * These are local overrides for various environment variables in Emacs.
171 * Please do not remove this and leave it at the end of the file, where
172 * Emacs will automagically detect them.
173 * ---------------------------------------------------------------------
176 * indent-tabs-mode: t