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/llni.h"
39 #include "native/native.h"
41 #if defined(WITH_CLASSPATH_SUN)
42 # include "native/include/java_lang_String.h" /* required by j.l.CL */
43 # include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
44 # include "native/include/java_lang_ClassLoader.h" /* required my j.l.C */
47 #include "native/include/java_lang_Object.h" /* required my j.l.C */
48 #include "native/include/java_lang_Class.h"
49 #include "native/include/java_lang_String.h"
51 #include "native/include/java_lang_reflect_Constructor.h"
53 #include "native/vm/java_lang_reflect_Constructor.h"
55 #include "toolbox/logging.h"
57 #include "vm/builtin.h"
58 #include "vm/exceptions.h"
59 #include "vm/access.h"
60 #include "vm/stringlocal.h"
62 #include "vmcore/class.h"
63 #include "vmcore/method.h"
67 * Class: java/lang/reflect/Constructor
68 * Method: getModifiers
71 s4 _Jv_java_lang_reflect_Constructor_getModifiers(JNIEnv *env, java_lang_reflect_Constructor *this)
77 LLNI_field_get_cls(this, clazz, c);
78 LLNI_field_get_val(this, slot , slot);
79 m = &(c->methods[slot]);
86 * Class: java/lang/reflect/Constructor
87 * Method: getParameterTypes
88 * Signature: ()[Ljava/lang/Class;
90 java_handle_objectarray_t *_Jv_java_lang_reflect_Constructor_getParameterTypes(JNIEnv *env, java_lang_reflect_Constructor *this)
96 LLNI_field_get_cls(this, clazz, c);
97 LLNI_field_get_val(this, slot , slot);
98 m = &(c->methods[slot]);
100 return method_get_parametertypearray(m);
105 * Class: java/lang/reflect/Constructor
106 * Method: getExceptionTypes
107 * Signature: ()[Ljava/lang/Class;
109 java_handle_objectarray_t *_Jv_java_lang_reflect_Constructor_getExceptionTypes(JNIEnv *env, java_lang_reflect_Constructor *this)
115 LLNI_field_get_cls(this, clazz, c);
116 LLNI_field_get_val(this, slot , slot);
117 m = &(c->methods[slot]);
119 return method_get_exceptionarray(m);
124 * Class: java/lang/reflect/Constructor
125 * Method: newInstance
126 * Signature: ([Ljava/lang/Object;)Ljava/lang/Object;
128 java_lang_Object *_Jv_java_lang_reflect_Constructor_newInstance(JNIEnv *env, java_lang_reflect_Constructor *this, java_handle_objectarray_t *args)
136 LLNI_field_get_cls(this, clazz, c);
137 LLNI_field_get_val(this, slot , slot);
138 m = &(c->methods[slot]);
140 /* check method access */
142 /* check if we should bypass security checks (AccessibleObject) */
144 #if defined(WITH_CLASSPATH_GNU)
145 LLNI_field_get_val(this, flag, override);
146 #elif defined(WITH_CLASSPATH_SUN)
147 LLNI_field_get_val(this, override, override);
149 # error unknown classpath configuration
152 if (override == false) {
153 if (!access_check_method(m, 1))
164 /* call initializer */
166 (void) _Jv_jni_invokeNative(m, o, args);
168 return (java_lang_Object *) o;
173 * Class: java/lang/reflect/Constructor
174 * Method: getSignature
175 * Signature: ()Ljava/lang/String;
177 java_lang_String *_Jv_java_lang_reflect_Constructor_getSignature(JNIEnv *env, java_lang_reflect_Constructor *this)
184 LLNI_field_get_cls(this, clazz, c);
185 LLNI_field_get_val(this, slot , slot);
186 m = &(c->methods[slot]);
188 if (m->signature == NULL)
191 o = javastring_new(m->signature);
193 /* in error case o is NULL */
195 return (java_lang_String *) o;
200 * These are local overrides for various environment variables in Emacs.
201 * Please do not remove this and leave it at the end of the file, where
202 * Emacs will automagically detect them.
203 * ---------------------------------------------------------------------
206 * indent-tabs-mode: t