(_Jv_java_lang_Class_getDeclaredAnnotations): Use LLNI_* macro.
* src/native/vm/gnu/java_lang_reflect_Method.c
(Java_java_lang_reflect_Method_getDefaultValue): Use LLNI_* macros.
(Java_java_lang_reflect_Method_declaredAnnotations): Use LLNI_* macros.
(Java_java_lang_reflect_Method_getParameterAnnotations): Use LLNI_* macros.
* src/native/vm/gnu/java_lang_reflect_Field.c
(Java_java_lang_reflect_Field_declaredAnnotations): Use LLNI_* macros.
* src/native/vm/gnu/java_lang_reflect_Constructor.c
(Java_java_lang_reflect_Constructor_declaredAnnotations): Use LLNI_* macros.
(Java_java_lang_reflect_Constructor_getParameterAnnotations): Use LLNI_* macros.
* src/native/vm/sun/jvm.c
(native/llni.h): Added include.
(JVM_GetFieldAnnotations): Use LLNI_* macros.
(JVM_GetMethodAnnotations): Use LLNI_* macros.
(JVM_GetMethodDefaultAnnotationValue): Use LLNI_* macros.
(JVM_GetMethodParameterAnnotations): Use LLNI_* macros.
(JVM_GetClassConstantPool): Use LLNI_* macros.
* src/native/vm/reflect.c
(reflect_constructor_new): Forgot to set annotations and parameterAnnotations
attributes for GNU Classpath.
(reflect_get_declaredannotatios): Use LLNI_* macros.
(reflect_get_parameterannotations): Use LLNI_* macros.
* src/native/vm/reflect.h
(reflect_get_declaredannotatios): Now the caller has to set the
declaredAnnotations attribute of the according object itself, because the
LLNI_* macros can't get the address of an field.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Constructor.c 8295 2007-08-11 17:57:24Z michi $
+ $Id: java_lang_reflect_Constructor.c 8305 2007-08-15 13:49:26Z panzi $
*/
*/
JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Constructor_declaredAnnotations(JNIEnv *env, struct java_lang_reflect_Constructor* this)
{
- java_handle_t *o = (java_handle_t*)this;
+ java_handle_t *o = (java_handle_t*)this;
+ struct java_util_Map *declaredAnnotations = NULL;
+ java_bytearray *annotations = NULL;
+ java_lang_Class *declaringClass = NULL;
if (this == NULL) {
exceptions_throw_nullpointerexception();
return NULL;
}
+
+ LLNI_field_get_ref(this, declaredAnnotations, declaredAnnotations);
- return reflect_get_declaredannotatios(&(this->declaredAnnotations), this->annotations, this->clazz, o->vftbl->class);
+ if (declaredAnnotations == NULL) {
+ LLNI_field_get_val(this, annotations, annotations);
+ LLNI_field_get_ref(this, clazz, declaringClass);
+
+ declaredAnnotations = reflect_get_declaredannotatios(annotations, declaringClass, o->vftbl->class);
+
+ LLNI_field_set_ref(this, declaredAnnotations, declaredAnnotations);
+ }
+
+ return declaredAnnotations;
}
*/
JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Constructor_getParameterAnnotations(JNIEnv *env, struct java_lang_reflect_Constructor* this)
{
- java_handle_t *o = (java_handle_t*)this;
+ java_handle_t *o = (java_handle_t*)this;
+ java_bytearray *parameterAnnotations = NULL;
+ int32_t slot = -1;
+ java_lang_Class *declaringClass = NULL;
if (this == NULL) {
exceptions_throw_nullpointerexception();
return NULL;
}
- return reflect_get_parameterannotations((java_handle_t*)this->parameterAnnotations, this->slot, this->clazz, o->vftbl->class);
+ LLNI_field_get_ref(this, parameterAnnotations, parameterAnnotations);
+ LLNI_field_get_val(this, slot, slot);
+ LLNI_field_get_ref(this, clazz, declaringClass);
+
+ return reflect_get_parameterannotations((java_handle_t*)parameterAnnotations, slot, declaringClass, o->vftbl->class);
}
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Field.c 8295 2007-08-11 17:57:24Z michi $
+ $Id: java_lang_reflect_Field.c 8305 2007-08-15 13:49:26Z panzi $
*/
*/
JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Field_declaredAnnotations(JNIEnv *env, struct java_lang_reflect_Field* this)
{
- java_handle_t *o = (java_handle_t*)this;
+ java_handle_t *o = (java_handle_t*)this;
+ struct java_util_Map *declaredAnnotations = NULL;
+ java_bytearray *annotations = NULL;
+ java_lang_Class *declaringClass = NULL;
if (this == NULL) {
exceptions_throw_nullpointerexception();
return NULL;
}
- return reflect_get_declaredannotatios(&(this->declaredAnnotations), this->annotations, this->clazz, o->vftbl->class);
+ LLNI_field_get_ref(this, declaredAnnotations, declaredAnnotations);
+
+ if (declaredAnnotations == NULL) {
+ LLNI_field_get_val(this, annotations, annotations);
+ LLNI_field_get_ref(this, clazz, declaringClass);
+
+ declaredAnnotations = reflect_get_declaredannotatios(annotations, declaringClass, o->vftbl->class);
+
+ LLNI_field_set_ref(this, declaredAnnotations, declaredAnnotations);
+ }
+
+ return declaredAnnotations;
}
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Method.c 8295 2007-08-11 17:57:24Z michi $
+ $Id: java_lang_reflect_Method.c 8305 2007-08-15 13:49:26Z panzi $
*/
{
static methodinfo *m_parseAnnotationDefault = NULL;
utf *utf_parseAnnotationDefault = NULL;
- utf *utf_desc = NULL;
- sun_reflect_ConstantPool *constantPool = NULL;
- java_handle_t *o = (java_handle_t*)this;
+ utf *utf_desc = NULL;
+ sun_reflect_ConstantPool *constantPool = NULL;
+ java_handle_t *o = (java_handle_t*)this;
+ java_lang_Object *constantPoolOop = NULL;
if (this == NULL) {
exceptions_throw_nullpointerexception();
return NULL;
}
- constantPool->constantPoolOop = (java_lang_Object*)this->clazz;
+ LLNI_field_get_ref(this, clazz, constantPoolOop);
+ LLNI_field_set_ref(constantPool, constantPoolOop, constantPoolOop);
/* only resolve the method the first time */
if (m_parseAnnotationDefault == NULL) {
*/
JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Method_declaredAnnotations(JNIEnv *env, struct java_lang_reflect_Method* this)
{
- java_handle_t *o = (java_handle_t*)this;
+ java_handle_t *o = (java_handle_t*)this;
+ struct java_util_Map *declaredAnnotations = NULL;
+ java_bytearray *annotations = NULL;
+ java_lang_Class *declaringClass = NULL;
if (this == NULL) {
exceptions_throw_nullpointerexception();
return NULL;
}
- return reflect_get_declaredannotatios(&(this->declaredAnnotations), this->annotations, this->clazz, o->vftbl->class);
+ LLNI_field_get_ref(this, declaredAnnotations, declaredAnnotations);
+
+ if (declaredAnnotations == NULL) {
+ LLNI_field_get_val(this, annotations, annotations);
+ LLNI_field_get_ref(this, clazz, declaringClass);
+
+ declaredAnnotations = reflect_get_declaredannotatios(annotations, declaringClass, o->vftbl->class);
+
+ LLNI_field_set_ref(this, declaredAnnotations, declaredAnnotations);
+ }
+
+ return declaredAnnotations;
}
*/
JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Method_getParameterAnnotations(JNIEnv *env, struct java_lang_reflect_Method* this)
{
- java_handle_t *o = (java_handle_t*)this;
+ java_handle_t *o = (java_handle_t*)this;
+ java_bytearray *parameterAnnotations = NULL;
+ int32_t slot = -1;
+ java_lang_Class *declaringClass = NULL;
if (this == NULL) {
exceptions_throw_nullpointerexception();
return NULL;
}
- return reflect_get_parameterannotations((java_handle_t*)this->parameterAnnotations, this->slot, this->clazz, o->vftbl->class);
+ LLNI_field_get_ref(this, parameterAnnotations, parameterAnnotations);
+ LLNI_field_get_val(this, slot, slot);
+ LLNI_field_get_ref(this, clazz, declaringClass);
+
+ return reflect_get_parameterannotations((java_handle_t*)parameterAnnotations, slot, declaringClass, o->vftbl->class);
}
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_Class.c 8295 2007-08-11 17:57:24Z michi $
+ $Id: java_lang_Class.c 8305 2007-08-15 13:49:26Z panzi $
*/
java_bytearray *annotations = NULL;
sun_reflect_ConstantPool *constantPool = NULL;
uint32_t size = 0;
+ java_lang_Object *o = (java_lang_Object*)klass;
if (c == NULL) {
exceptions_throw_nullpointerexception();
return NULL;
}
- constantPool->constantPoolOop = (java_lang_Object*)klass;
+ LLNI_field_set_ref(constantPool, constantPoolOop, o);
/* only resolve the method the first time */
if (m_parseAnnotationsIntoArray == NULL) {
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: reflect.c 8295 2007-08-11 17:57:24Z michi $
+ $Id: reflect.c 8305 2007-08-15 13:49:26Z panzi $
*/
LLNI_field_set_cls(rc, clazz , c);
LLNI_field_set_val(rc, slot , slot);
-
- /* TODO: add these private fields to java.lang.reflect.Constructor
LLNI_field_set_ref(rc, annotations , annotations);
LLNI_field_set_ref(rc, parameterAnnotations, parameterAnnotations);
- */
#elif defined(WITH_CLASSPATH_SUN)
#if defined(WITH_CLASSPATH_GNU) && defined(ENABLE_ANNOTATIONS)
/* reflect_get_declaredannotatios *********************************************
- Returnes a java.util.Map<Class, Annotation> of the declared
- annotations. Only calls the AnnotationParser if the declared
- annotations are not yet parsed.
+ Returns a java.util.Map<Class, Annotation> of the declared
+ annotations.
*******************************************************************************/
struct java_util_Map* reflect_get_declaredannotatios(
- struct java_util_Map **declaredAnnotations,
- java_bytearray *annotations,
- java_lang_Class *declaringClass,
- classinfo *referer)
+ java_bytearray *annotations,
+ java_lang_Class *declaringClass,
+ classinfo *referer)
{
static methodinfo *m_parseAnnotations = NULL;
utf *utf_parseAnnotations = NULL;
utf *utf_desc = NULL;
sun_reflect_ConstantPool *constantPool = NULL;
+ java_lang_Object *constantPoolOop = (java_lang_Object*)declaringClass;
- if (*declaredAnnotations == NULL) {
- constantPool =
- (sun_reflect_ConstantPool*)native_new_and_init(
- class_sun_reflect_ConstantPool);
+ constantPool =
+ (sun_reflect_ConstantPool*)native_new_and_init(
+ class_sun_reflect_ConstantPool);
- if(constantPool == NULL) {
+ if(constantPool == NULL) {
+ /* out of memory */
+ return NULL;
+ }
+
+ LLNI_field_set_ref(constantPool, constantPoolOop, constantPoolOop);
+
+ /* only resolve the method the first time */
+ if (m_parseAnnotations == NULL) {
+ utf_parseAnnotations = utf_new_char("parseAnnotations");
+ utf_desc = utf_new_char(
+ "([BLsun/reflect/ConstantPool;Ljava/lang/Class;)"
+ "Ljava/util/Map;");
+
+ if (utf_parseAnnotations == NULL || utf_desc == NULL) {
/* out of memory */
return NULL;
}
- constantPool->constantPoolOop = (java_lang_Object*)declaringClass;
-
- /* only resolve the method the first time */
- if (m_parseAnnotations == NULL) {
- utf_parseAnnotations = utf_new_char("parseAnnotations");
- utf_desc = utf_new_char(
- "([BLsun/reflect/ConstantPool;Ljava/lang/Class;)"
- "Ljava/util/Map;");
-
- if (utf_parseAnnotations == NULL || utf_desc == NULL) {
- /* out of memory */
- return NULL;
- }
-
- m_parseAnnotations = class_resolveclassmethod(
- class_sun_reflect_annotation_AnnotationParser,
- utf_parseAnnotations,
- utf_desc,
- referer,
- true);
+ m_parseAnnotations = class_resolveclassmethod(
+ class_sun_reflect_annotation_AnnotationParser,
+ utf_parseAnnotations,
+ utf_desc,
+ referer,
+ true);
- if (m_parseAnnotations == NULL) {
- /* method not found */
- return NULL;
- }
+ if (m_parseAnnotations == NULL) {
+ /* method not found */
+ return NULL;
}
-
- *declaredAnnotations =
- (struct java_util_Map*)vm_call_method(
- m_parseAnnotations, NULL, annotations,
- constantPool, declaringClass);
}
- return *declaredAnnotations;
+ return (struct java_util_Map*)vm_call_method(
+ m_parseAnnotations, NULL, annotations,
+ constantPool, declaringClass);
}
*/
static methodinfo *m_parseParameterAnnotations = NULL;
utf *utf_parseParameterAnnotations = NULL;
- utf *utf_desc = NULL;
- sun_reflect_ConstantPool *constantPool = NULL;
- classinfo *c = NULL;
- methodinfo *m = NULL;
- int32_t numParameters = -1;
+ utf *utf_desc = NULL;
+ sun_reflect_ConstantPool *constantPool = NULL;
+ java_lang_Object *constantPoolOop = (java_lang_Object*)declaringClass;
+ classinfo *c = NULL;
+ methodinfo *m = NULL;
+ int32_t numParameters = -1;
/* get parameter count */
return NULL;
}
- constantPool->constantPoolOop = (java_lang_Object*)declaringClass;
+ LLNI_field_set_ref(constantPool, constantPoolOop, constantPoolOop);
/* only resolve the method the first time */
if (m_parseParameterAnnotations == NULL) {
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: reflect.h 8295 2007-08-11 17:57:24Z michi $
+ $Id: reflect.h 8305 2007-08-15 13:49:26Z panzi $
*/
#if defined(WITH_CLASSPATH_GNU) && defined(ENABLE_ANNOTATIONS)
struct java_util_Map* reflect_get_declaredannotatios(
- struct java_util_Map **declaredAnnotations,
- java_bytearray *annotations,
- java_lang_Class *declaringClass,
- classinfo *referer);
+ java_bytearray *annotations,
+ java_lang_Class *declaringClass,
+ classinfo *referer);
java_objectarray* reflect_get_parameterannotations(
java_handle_t *parameterAnnotations,
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jvm.c 8295 2007-08-11 17:57:24Z michi $
+ $Id: jvm.c 8305 2007-08-15 13:49:26Z panzi $
*/
#include "mm/memory.h"
#include "native/jni.h"
+#include "native/llni.h"
#include "native/native.h"
#include "native/include/java_lang_AssertionStatusDirectives.h"
jbyteArray JVM_GetFieldAnnotations(JNIEnv *env, jobject field)
{
java_lang_reflect_Field *rf = (java_lang_reflect_Field*)field;
+ java_bytearray *ba = NULL;
TRACEJVMCALLS("JVM_GetFieldAnnotations: field=%p", field);
return NULL;
}
- return (jbyteArray)rf->annotations;
+ LLNI_field_get_ref(rf, annotations, ba);
+
+ return (jbyteArray)ba;
}
jbyteArray JVM_GetMethodAnnotations(JNIEnv *env, jobject method)
{
java_lang_reflect_Method *rm = (java_lang_reflect_Method*)method;
+ java_bytearray *ba = NULL;
TRACEJVMCALLS("JVM_GetMethodAnnotations: method=%p", method);
return NULL;
}
- return (jbyteArray)rm->annotations;
+ LLNI_field_get_ref(rm, annotations, ba);
+
+ return (jbyteArray)ba;
}
jbyteArray JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method)
{
java_lang_reflect_Method *rm = (java_lang_reflect_Method*)method;
+ java_bytearray *ba = NULL;
TRACEJVMCALLS("JVM_GetMethodDefaultAnnotationValue: method=%p", method);
return NULL;
}
- return (jbyteArray)rm->annotationDefault;
+ LLNI_field_get_ref(rm, annotationDefault, ba);
+
+ return (jbyteArray)ba;
}
jbyteArray JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method)
{
java_lang_reflect_Method *rm = (java_lang_reflect_Method*)method;
+ java_bytearray *ba = NULL;
TRACEJVMCALLS("JVM_GetMethodParameterAnnotations: method=%p", method);
return NULL;
}
- return (jbyteArray)rm->parameterAnnotations;
+ LLNI_field_get_ref(rm, parameterAnnotations, ba);
+
+ return (jbyteArray)ba;
}
jobject JVM_GetClassConstantPool(JNIEnv *env, jclass cls)
{
#if defined(ENABLE_ANNOTATIONS)
- sun_reflect_ConstantPool *constantPool = NULL;
+ sun_reflect_ConstantPool *constantPool = NULL;
+ java_lang_Object *constantPoolOop = (java_lang_Object*)cls;
TRACEJVMCALLS("JVM_GetClassConstantPool: cls=%p", cls);
return NULL;
}
- constantPool->constantPoolOop = (java_lang_Object*)cls;
+ LLNI_field_set_ref(constantPool, constantPoolOop, constantPoolOop);
+
return (jobject)constantPool;
#else
log_println("JVM_GetClassConstantPool: cls=%p, not implemented in this configuration!", cls);
return NULL;
}
- if (!resolve_classref(NULL,ref,resolveLazy,true,true,&c)) {
+ if (!resolve_classref(NULL, ref, resolveLazy, true, true, &c)) {
return NULL;
}
return NULL;
}
- if (!resolve_classref(NULL,ref->p.classref,resolveLazy,true,true,&c)) {
+ if (!resolve_classref(NULL, ref->p.classref, resolveLazy, true, true, &c)) {
return NULL;
}
return NULL;
}
- if (!resolve_classref(NULL,ref->p.classref,resolveLazy,true,true,&c)) {
+ if (!resolve_classref(NULL, ref->p.classref, resolveLazy, true, true, &c)) {
return NULL;
}