Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Constructor.c 8284 2007-08-10 08:58:39Z michi $
+ $Id: java_lang_reflect_Constructor.c 8285 2007-08-10 09:20:04Z michi $
*/
#include <assert.h>
#include <stdlib.h>
+#if defined(ENABLE_ANNOTATIONS)
+#include "vm/vm.h"
+#endif
+
#include "vm/types.h"
#include "native/jni.h"
#include "native/include/java_lang_String.h"
#include "native/include/java_lang_reflect_Constructor.h"
+#if defined(ENABLE_ANNOTATIONS)
+#include "native/include/sun_reflect_ConstantPool.h"
+#include "native/vm/reflect.h"
+#endif
+
#include "native/vm/java_lang_reflect_Constructor.h"
#include "vmcore/utf8.h"
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "getModifiersInternal", "()I", (void *) (ptrint) &_Jv_java_lang_reflect_Constructor_getModifiers },
- { "getParameterTypes", "()[Ljava/lang/Class;", (void *) (ptrint) &_Jv_java_lang_reflect_Constructor_getParameterTypes },
- { "getExceptionTypes", "()[Ljava/lang/Class;", (void *) (ptrint) &_Jv_java_lang_reflect_Constructor_getExceptionTypes },
- { "constructNative", "([Ljava/lang/Object;Ljava/lang/Class;I)Ljava/lang/Object;", (void *) (ptrint) &Java_java_lang_reflect_Constructor_constructNative },
- { "getSignature", "()Ljava/lang/String;", (void *) (ptrint) &_Jv_java_lang_reflect_Constructor_getSignature },
+ { "getModifiersInternal", "()I", (void *) (ptrint) &_Jv_java_lang_reflect_Constructor_getModifiers },
+ { "getParameterTypes", "()[Ljava/lang/Class;", (void *) (ptrint) &_Jv_java_lang_reflect_Constructor_getParameterTypes },
+ { "getExceptionTypes", "()[Ljava/lang/Class;", (void *) (ptrint) &_Jv_java_lang_reflect_Constructor_getExceptionTypes },
+ { "constructNative", "([Ljava/lang/Object;Ljava/lang/Class;I)Ljava/lang/Object;", (void *) (ptrint) &Java_java_lang_reflect_Constructor_constructNative },
+ { "getSignature", "()Ljava/lang/String;", (void *) (ptrint) &_Jv_java_lang_reflect_Constructor_getSignature },
+#if defined(ENABLE_ANNOTATIONS)
+ { "declaredAnnotations", "()Ljava/util/Map;", (void *) (ptrint) &Java_java_lang_reflect_Constructor_declaredAnnotations },
+ { "getParameterAnnotations", "()[[Ljava/lang/annotation/Annotation;", (void *) (ptrint) &Java_java_lang_reflect_Constructor_getParameterAnnotations },
+#endif
};
}
+#if defined(ENABLE_ANNOTATIONS)
+/*
+ * Class: java/lang/reflect/Constructor
+ * Method: declaredAnnotations
+ * Signature: ()Ljava/util/Map;
+ */
+JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Constructor_declaredAnnotations(JNIEnv *env, struct java_lang_reflect_Constructor* this)
+{
+ java_objectheader *o = (java_objectheader*)this;
+
+ if (this == NULL) {
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ return reflect_get_declaredannotatios(&(this->declaredAnnotations), this->annotations, this->clazz, o->vftbl->class);
+}
+
+
+/*
+ * Class: java/lang/reflect/Constructor
+ * Method: getParameterAnnotations
+ * Signature: ()[[Ljava/lang/annotation/Annotation;
+ */
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Constructor_getParameterAnnotations(JNIEnv *env, struct java_lang_reflect_Constructor* this)
+{
+ java_objectheader *o = (java_objectheader*)this;
+
+ if (this == NULL) {
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ return reflect_get_parameterannotations((java_objectheader*)this->parameterAnnotations, this->slot, this->clazz, o->vftbl->class);
+}
+#endif
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Method.c 8284 2007-08-10 08:58:39Z michi $
+ $Id: java_lang_reflect_Method.c 8285 2007-08-10 09:20:04Z michi $
*/
#include <assert.h>
+#if defined(ENABLE_ANNOTATIONS)
+#include "vm/vm.h"
+#endif
+
#include "vm/types.h"
#include "native/jni.h"
#include "native/include/java_lang_Class.h"
#include "native/include/java_lang_String.h"
+#if defined(ENABLE_ANNOTATIONS)
+#include "native/include/sun_reflect_ConstantPool.h"
+#include "native/vm/reflect.h"
+#endif
+
#include "native/include/java_lang_reflect_Method.h"
#include "native/vm/java_lang_reflect_Method.h"
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "getModifiersInternal", "()I", (void *) (ptrint) &Java_java_lang_reflect_Method_getModifiersInternal },
- { "getReturnType", "()Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_reflect_Method_getReturnType },
- { "getParameterTypes", "()[Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_reflect_Method_getParameterTypes },
- { "getExceptionTypes", "()[Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_reflect_Method_getExceptionTypes },
- { "invokeNative", "(Ljava/lang/Object;[Ljava/lang/Object;Ljava/lang/Class;I)Ljava/lang/Object;", (void *) (ptrint) &Java_java_lang_reflect_Method_invokeNative },
- { "getSignature", "()Ljava/lang/String;", (void *) (ptrint) &Java_java_lang_reflect_Method_getSignature },
+ { "getModifiersInternal", "()I", (void *) (ptrint) &Java_java_lang_reflect_Method_getModifiersInternal },
+ { "getReturnType", "()Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_reflect_Method_getReturnType },
+ { "getParameterTypes", "()[Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_reflect_Method_getParameterTypes },
+ { "getExceptionTypes", "()[Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_reflect_Method_getExceptionTypes },
+ { "invokeNative", "(Ljava/lang/Object;[Ljava/lang/Object;Ljava/lang/Class;I)Ljava/lang/Object;", (void *) (ptrint) &Java_java_lang_reflect_Method_invokeNative },
+ { "getSignature", "()Ljava/lang/String;", (void *) (ptrint) &Java_java_lang_reflect_Method_getSignature },
+#if defined(ENABLE_ANNOTATIONS)
+ { "getDefaultValue", "()Ljava/lang/Object;", (void *) (ptrint) &Java_java_lang_reflect_Method_getDefaultValue },
+ { "declaredAnnotations", "()Ljava/util/Map;", (void *) (ptrint) &Java_java_lang_reflect_Method_declaredAnnotations },
+ { "getParameterAnnotations", "()[[Ljava/lang/annotation/Annotation;", (void *) (ptrint) &Java_java_lang_reflect_Method_getParameterAnnotations },
+#endif
};
return (java_lang_String *) o;
}
+#if defined(ENABLE_ANNOTATIONS)
+/*
+ * Class: java/lang/reflect/Method
+ * Method: getDefaultValue
+ * Signature: ()Ljava/lang/Object;
+ */
+JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Method_getDefaultValue(JNIEnv *env, struct java_lang_reflect_Method* this)
+{
+ static methodinfo *m_parseAnnotationDefault = NULL;
+ utf *utf_parseAnnotationDefault = NULL;
+ utf *utf_desc = NULL;
+ sun_reflect_ConstantPool *constantPool = NULL;
+ java_objectheader *o = (java_objectheader*)this;
+
+ if (this == NULL) {
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ constantPool =
+ (sun_reflect_ConstantPool*)native_new_and_init(
+ class_sun_reflect_ConstantPool);
+
+ if(constantPool == NULL) {
+ /* out of memory */
+ return NULL;
+ }
+
+ constantPool->constantPoolOop = (java_lang_Object*)this->clazz;
+
+ /* only resolve the method the first time */
+ if (m_parseAnnotationDefault == NULL) {
+ utf_parseAnnotationDefault = utf_new_char("parseAnnotationDefault");
+ utf_desc = utf_new_char(
+ "(Ljava/lang/reflect/Method;[BLsun/reflect/ConstantPool;)"
+ "Ljava/lang/Object;");
+
+ if (utf_parseAnnotationDefault == NULL || utf_desc == NULL) {
+ /* out of memory */
+ return NULL;
+ }
+
+ m_parseAnnotationDefault = class_resolveclassmethod(
+ class_sun_reflect_annotation_AnnotationParser,
+ utf_parseAnnotationDefault,
+ utf_desc,
+ o->vftbl->class,
+ true);
+
+ if (m_parseAnnotationDefault == NULL)
+ {
+ /* method not found */
+ return NULL;
+ }
+ }
+
+ return (java_lang_Object*)vm_call_method(
+ m_parseAnnotationDefault, NULL,
+ this, this->annotationDefault, constantPool);
+}
+
+
+/*
+ * Class: java/lang/reflect/Method
+ * Method: declaredAnnotations
+ * Signature: ()Ljava/util/Map;
+ */
+JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Method_declaredAnnotations(JNIEnv *env, struct java_lang_reflect_Method* this)
+{
+ java_objectheader *o = (java_objectheader*)this;
+
+ if (this == NULL) {
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ return reflect_get_declaredannotatios(&(this->declaredAnnotations), this->annotations, this->clazz, o->vftbl->class);
+}
+
+
+/*
+ * Class: java/lang/reflect/Method
+ * Method: getParameterAnnotations
+ * Signature: ()[[Ljava/lang/annotation/Annotation;
+ */
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Method_getParameterAnnotations(JNIEnv *env, struct java_lang_reflect_Method* this)
+{
+ java_objectheader *o = (java_objectheader*)this;
+
+ if (this == NULL) {
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ return reflect_get_parameterannotations((java_objectheader*)this->parameterAnnotations, this->slot, this->clazz, o->vftbl->class);
+}
+#endif
+
/*
* These are local overrides for various environment variables in Emacs.