1 /* src/native/vm/java_lang_reflect_Constructor.c
3 Copyright (C) 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 7976 2007-05-29 12:22:55Z twisti $
37 #include "native/jni.h"
38 #include "native/native.h"
40 #include "native/include/java_lang_Class.h"
41 #include "native/include/java_lang_Object.h"
42 #include "native/include/java_lang_String.h"
44 #include "native/include/java_lang_reflect_Constructor.h"
46 #include "native/vm/java_lang_reflect_Constructor.h"
48 #include "toolbox/logging.h"
50 #include "vm/builtin.h"
51 #include "vm/exceptions.h"
52 #include "vm/access.h"
53 #include "vm/stringlocal.h"
55 #include "vmcore/class.h"
56 #include "vmcore/method.h"
60 * Class: java/lang/reflect/Constructor
61 * Method: getModifiers
64 s4 _Jv_java_lang_reflect_Constructor_getModifiers(JNIEnv *env, java_lang_reflect_Constructor *this)
69 c = (classinfo *) (this->clazz);
70 m = &(c->methods[this->slot]);
77 * Class: java/lang/reflect/Constructor
78 * Method: getParameterTypes
79 * Signature: ()[Ljava/lang/Class;
81 java_objectarray *_Jv_java_lang_reflect_Constructor_getParameterTypes(JNIEnv *env, java_lang_reflect_Constructor *this)
86 c = (classinfo *) this->clazz;
87 m = &(c->methods[this->slot]);
89 return method_get_parametertypearray(m);
94 * Class: java/lang/reflect/Constructor
95 * Method: getExceptionTypes
96 * Signature: ()[Ljava/lang/Class;
98 java_objectarray *_Jv_java_lang_reflect_Constructor_getExceptionTypes(JNIEnv *env, java_lang_reflect_Constructor *this)
103 c = (classinfo *) this->clazz;
104 m = &(c->methods[this->slot]);
106 return method_get_exceptionarray(m);
111 * Class: java/lang/reflect/Constructor
112 * Method: newInstance
113 * Signature: ([Ljava/lang/Object;)Ljava/lang/Object;
115 java_lang_Object *_Jv_java_lang_reflect_Constructor_newInstance(JNIEnv *env, java_lang_reflect_Constructor *this, java_objectarray *args)
119 java_objectheader *o;
121 c = (classinfo *) this->clazz;
122 m = &(c->methods[this->slot]);
124 /* check method access */
126 /* check if we should bypass security checks (AccessibleObject) */
128 if (this->flag == false) {
129 if (!access_check_method(m, 1))
140 /* call initializer */
142 (void) _Jv_jni_invokeNative(m, o, args);
144 return (java_lang_Object *) o;
149 * Class: java/lang/reflect/Constructor
150 * Method: getSignature
151 * Signature: ()Ljava/lang/String;
153 java_lang_String *_Jv_java_lang_reflect_Constructor_getSignature(JNIEnv *env, java_lang_reflect_Constructor *this)
157 java_objectheader *o;
159 c = (classinfo *) this->clazz;
160 m = &(c->methods[this->slot]);
162 if (m->signature == NULL)
165 o = javastring_new(m->signature);
167 /* in error case o is NULL */
169 return (java_lang_String *) o;
174 * These are local overrides for various environment variables in Emacs.
175 * Please do not remove this and leave it at the end of the file, where
176 * Emacs will automagically detect them.
177 * ---------------------------------------------------------------------
180 * indent-tabs-mode: t