Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_Class.c 8132 2007-06-22 11:15:47Z twisti $
-
*/
#include "config.h"
#include <assert.h>
+#include <stdint.h>
#include <string.h>
#include "vm/types.h"
#include "mm/memory.h"
#include "native/jni.h"
+#include "native/llni.h"
#include "native/native.h"
/* keep this order of the native includes */
#endif
#include "native/vm/java_lang_Class.h"
-#include "native/vm/java_lang_String.h"
+
+#if defined(ENABLE_JAVASE)
+# include "native/vm/reflect.h"
+#endif
#include "toolbox/logging.h"
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/initialize.h"
+#include "vm/primitive.h"
#include "vm/resolve.h"
#include "vm/stringlocal.h"
#include "vmcore/class.h"
#include "vmcore/loader.h"
-#include "vmcore/primitive.h"
+#if defined(WITH_CLASSPATH_GNU) && defined(ENABLE_ANNOTATIONS)
+#include "vm/vm.h"
+#include "vmcore/annotation.h"
+#include "native/include/sun_reflect_ConstantPool.h"
+#endif
/*
* Class: java/lang/Class
{
classinfo *c;
java_lang_String *s;
+ java_chararray_t *ca;
u4 i;
- c = (classinfo *) klass;
+ c = LLNI_classinfo_unwrap(klass);
/* create a java string */
/* return string where '/' is replaced by '.' */
- for (i = 0; i < s->value->header.size; i++) {
- if (s->value->data[i] == '/')
- s->value->data[i] = '.';
+ LLNI_field_get_ref(s, value, ca);
+
+ for (i = 0; i < LLNI_array_size(ca); i++) {
+ if (LLNI_array_direct(ca, i) == '/')
+ LLNI_array_direct(ca, i) = '.';
}
return s;
#endif
{
#if defined(ENABLE_JAVASE)
- java_objectheader *cl;
+ classloader *cl;
#endif
- utf *ufile;
- utf *uname;
- classinfo *c;
- u2 *pos;
- s4 i;
+ utf *ufile;
+ utf *uname;
+ classinfo *c;
+ u2 *pos;
+ s4 i;
#if defined(ENABLE_JAVASE)
- cl = (java_objectheader *) loader;
+ cl = (classloader *) loader;
#endif
/* illegal argument */
/* create utf string in which '.' is replaced by '/' */
- ufile = javastring_toutf((java_objectheader *) name, true);
- uname = javastring_toutf((java_objectheader *) name, false);
+ ufile = javastring_toutf((java_handle_t *) name, true);
+ uname = javastring_toutf((java_handle_t *) name, false);
/* name must not contain '/' (mauve test) */
- for (i = 0, pos = name->value->data + name->offset; i < name->count; i++, pos++) {
+ for (i = 0, pos = LLNI_field_direct(name, value)->data + LLNI_field_direct(name, offset); i < LLNI_field_direct(name, count); i++, pos++) {
if (*pos == '/') {
exceptions_throw_classnotfoundexception(uname);
return NULL;
if (!initialize_class(c))
return NULL;
- return (java_lang_Class *) c;
+ return LLNI_classinfo_wrap(c);
}
*/
s4 _Jv_java_lang_Class_isInstance(java_lang_Class *klass, java_lang_Object *o)
{
- classinfo *c;
- java_objectheader *ob;
+ classinfo *c;
+ java_handle_t *ob;
- c = (classinfo *) klass;
- ob = (java_objectheader *) o;
+ c = LLNI_classinfo_unwrap(klass);
+ ob = (java_handle_t *) o;
if (!(c->state & CLASS_LINKED))
if (!link_class(c))
classinfo *kc;
classinfo *cc;
- kc = (classinfo *) klass;
- cc = (classinfo *) c;
+ kc = LLNI_classinfo_unwrap(klass);
+ cc = LLNI_classinfo_unwrap(c);
if (cc == NULL) {
exceptions_throw_nullpointerexception();
* Method: isInterface
* Signature: ()Z
*/
-s4 _Jv_java_lang_Class_isInterface(java_lang_Class *klass)
+JNIEXPORT int32_t JNICALL _Jv_java_lang_Class_isInterface(JNIEnv *env, java_lang_Class *this)
{
classinfo *c;
- c = (classinfo *) klass;
-
- if (c->flags & ACC_INTERFACE)
- return true;
+ c = LLNI_classinfo_unwrap(this);
- return false;
+ return class_is_interface(c);
}
s4 _Jv_java_lang_Class_isPrimitive(java_lang_Class *klass)
{
classinfo *c;
- bool result;
- c = (classinfo *) klass;
+ c = LLNI_classinfo_unwrap(klass);
- result = primitive_class_is_primitive(c);
-
- return result;
+ return class_is_primitive(c);
}
java_lang_Class *_Jv_java_lang_Class_getSuperclass(java_lang_Class *klass)
{
classinfo *c;
- classinfo *sc;
-
- c = (classinfo *) klass;
-
- /* for java.lang.Object, primitive and Void classes we return NULL */
+ classinfo *super;
- if (!c->super.any)
- return NULL;
-
- /* for interfaces we also return NULL */
+ c = LLNI_classinfo_unwrap(klass);
- if (c->flags & ACC_INTERFACE)
- return NULL;
+ super = class_get_superclass(c);
- /* we may have to resolve the super class reference */
-
- if ((sc = resolve_classref_or_classinfo_eager(c->super, true)) == NULL)
- return NULL;
-
- /* store the resolution */
-
- c->super.cls = sc;
-
- return (java_lang_Class *) sc;
+ return LLNI_classinfo_wrap(super);
}
* Method: getInterfaces
* Signature: ()[Ljava/lang/Class;
*/
-java_objectarray *_Jv_java_lang_Class_getInterfaces(java_lang_Class *klass)
+java_handle_objectarray_t *_Jv_java_lang_Class_getInterfaces(java_lang_Class *klass)
{
- classinfo *c;
- classinfo *ic;
- java_objectarray *oa;
- u4 i;
-
- c = (classinfo *) klass;
+ classinfo *c;
+ java_handle_objectarray_t *oa;
- if (!(c->state & CLASS_LINKED))
- if (!link_class(c))
- return NULL;
+ c = LLNI_classinfo_unwrap(klass);
- oa = builtin_anewarray(c->interfacescount, class_java_lang_Class);
-
- if (oa == NULL)
- return NULL;
-
- for (i = 0; i < c->interfacescount; i++) {
- ic = c->interfaces[i].cls;
-
- oa->data[i] = (java_objectheader *) ic;
- }
+ oa = class_get_interfaces(c);
return oa;
}
-/*
- * Class: java/lang/Class
- * Method: getComponentType
- * Signature: ()Ljava/lang/Class;
- */
-java_lang_Class *_Jv_java_lang_Class_getComponentType(java_lang_Class *klass)
-{
- classinfo *c;
- classinfo *comp;
- arraydescriptor *desc;
-
- c = (classinfo *) klass;
-
- /* XXX maybe we could find a way to do this without linking. */
- /* This way should be safe and easy, however. */
-
- if (!(c->state & CLASS_LINKED))
- if (!link_class(c))
- return NULL;
-
- desc = c->vftbl->arraydesc;
-
- if (desc == NULL)
- return NULL;
-
- if (desc->arraytype == ARRAYTYPE_OBJECT)
- comp = desc->componentvftbl->class;
- else
- comp = primitive_class_get_by_type(desc->arraytype);
-
- return (java_lang_Class *) comp;
-}
-
-
/*
* Class: java/lang/Class
* Method: getModifiers
utf *innername;
s4 i;
- c = (classinfo *) klass;
+ c = LLNI_classinfo_unwrap(klass);
if (!ignoreInnerClassesAttrib && (c->innerclasscount != 0)) {
/* search for passed class as inner class */
*/
java_lang_Class *_Jv_java_lang_Class_getDeclaringClass(java_lang_Class *klass)
{
- classinfo *c;
- classref_or_classinfo inner;
- utf *innername;
- classinfo *outer;
- s4 i;
-
- c = (classinfo *) klass;
-
- if (!primitive_class_is_primitive(c) && (c->name->text[0] != '[')) {
- if (c->innerclasscount == 0) /* no innerclasses exist */
- return NULL;
-
- for (i = 0; i < c->innerclasscount; i++) {
- inner = c->innerclass[i].inner_class;
-
- /* check if inner_class is a classref or a real class and
- get the class name from the structure */
-
- innername = IS_CLASSREF(inner) ? inner.ref->name : inner.cls->name;
-
- /* innerclass is this class */
-
- if (innername == c->name) {
- /* maybe the outer class is not loaded yet */
-
- if ((outer = resolve_classref_or_classinfo_eager(
- c->innerclass[i].outer_class,
- false)) == NULL)
- return NULL;
-
- if (!(outer->state & CLASS_LINKED))
- if (!link_class(outer))
- return NULL;
+ classinfo *c;
+ classinfo *dc;
- return (java_lang_Class *) outer;
- }
- }
- }
+ c = LLNI_classinfo_unwrap(klass);
- /* return NULL for arrayclasses and primitive classes */
+ dc = class_get_declaringclass(c);
- return NULL;
+ return LLNI_classinfo_wrap(dc);
}
* Method: getDeclaredClasses
* Signature: (Z)[Ljava/lang/Class;
*/
-java_objectarray *_Jv_java_lang_Class_getDeclaredClasses(java_lang_Class *klass, s4 publicOnly)
+java_handle_objectarray_t *_Jv_java_lang_Class_getDeclaredClasses(java_lang_Class *klass, s4 publicOnly)
{
- classinfo *c;
- classref_or_classinfo outer;
- utf *outername;
- s4 declaredclasscount; /* number of declared classes */
- s4 pos; /* current declared class */
- java_objectarray *oa; /* array of declared classes */
- s4 i;
+ classinfo *c;
+ java_handle_objectarray_t *oa;
- c = (classinfo *) klass;
- declaredclasscount = 0;
+ c = LLNI_classinfo_unwrap(klass);
- if (!primitive_class_is_primitive(c) && (c->name->text[0] != '[')) {
- /* determine number of declared classes */
-
- for (i = 0; i < c->innerclasscount; i++) {
- outer = c->innerclass[i].outer_class;
-
- /* check if outer_class is a classref or a real class and
- get the class name from the structure */
-
- outername = IS_CLASSREF(outer) ? outer.ref->name : outer.cls->name;
-
- /* outer class is this class */
-
- if ((outername == c->name) &&
- ((publicOnly == 0) || (c->innerclass[i].flags & ACC_PUBLIC)))
- declaredclasscount++;
- }
- }
-
- /* allocate Class[] and check for OOM */
-
- oa = builtin_anewarray(declaredclasscount, class_java_lang_Class);
-
- if (oa == NULL)
- return NULL;
-
- for (i = 0, pos = 0; i < c->innerclasscount; i++) {
- outer = c->innerclass[i].outer_class;
-
- /* check if outer_class is a classref or a real class and
- get the class name from the structure */
-
- outername = IS_CLASSREF(outer) ? outer.ref->name : outer.cls->name;
-
- /* outer class is this class */
-
- if ((outername == c->name) &&
- ((publicOnly == 0) || (c->innerclass[i].flags & ACC_PUBLIC))) {
- classinfo *inner;
-
- if ((inner = resolve_classref_or_classinfo_eager(
- c->innerclass[i].inner_class,
- false)) == NULL)
- return NULL;
-
- if (!(inner->state & CLASS_LINKED))
- if (!link_class(inner))
- return NULL;
-
- oa->data[pos++] = (java_objectheader *) inner;
- }
- }
+ oa = class_get_declaredclasses(c, publicOnly);
return oa;
}
* Method: getDeclaredFields
* Signature: (Z)[Ljava/lang/reflect/Field;
*/
-java_objectarray *_Jv_java_lang_Class_getDeclaredFields(java_lang_Class *klass, s4 publicOnly)
+java_handle_objectarray_t *_Jv_java_lang_Class_getDeclaredFields(java_lang_Class *klass, s4 publicOnly)
{
- classinfo *c;
- java_objectarray *oa; /* result: array of field-objects */
- fieldinfo *f;
- java_objectheader *o;
- java_lang_reflect_Field *rf;
+ classinfo *c;
+ java_handle_objectarray_t *oa; /* result: array of field-objects */
+ fieldinfo *f;
+ java_lang_reflect_Field *rf;
s4 public_fields; /* number of elements in field-array */
s4 pos;
s4 i;
- c = (classinfo *) klass;
+ c = LLNI_classinfo_unwrap(klass);
/* determine number of fields */
if ((f->flags & ACC_PUBLIC) || (publicOnly == 0)) {
/* create Field object */
- o = native_new_and_init(class_java_lang_reflect_Field);
-
- if (o == NULL)
- return NULL;
-
- /* initialize instance fields */
-
- rf = (java_lang_reflect_Field *) o;
-
-#if defined(WITH_CLASSPATH_GNU)
-
- rf->clazz = (java_lang_Class *) c;
-
- /* The name needs to be interned */
- /* XXX implement me better! */
-
- rf->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(f->name));
- rf->slot = i;
-
-#elif defined(WITH_CLASSPATH_SUN)
-
- rf->clazz = (java_lang_Class *) c;
-
- /* The name needs to be interned */
- /* XXX implement me better! */
-
- rf->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(f->name));
- rf->type = (java_lang_Class *) field_get_type(f);
- rf->modifiers = f->flags;
- rf->slot = i;
- rf->signature = f->signature ? (java_lang_String *) javastring_new(f->signature) : NULL;
- rf->annotations = NULL;
-#else
-# error unknown classpath configuration
-#endif
+ rf = reflect_field_new(f);
/* store object into array */
- oa->data[pos++] = o;
+ LLNI_objectarray_element_set(oa, pos, rf);
+ pos++;
}
}
* Method: getDeclaredMethods
* Signature: (Z)[Ljava/lang/reflect/Method;
*/
-java_objectarray *_Jv_java_lang_Class_getDeclaredMethods(java_lang_Class *klass, s4 publicOnly)
+java_handle_objectarray_t *_Jv_java_lang_Class_getDeclaredMethods(java_lang_Class *klass, s4 publicOnly)
{
- classinfo *c;
- java_objectheader *o;
- java_lang_reflect_Method *rm;
- java_objectarray *oa; /* result: array of Method-objects */
- methodinfo *m; /* the current method to be represented */
+ classinfo *c;
+ java_lang_reflect_Method *rm;
+ java_handle_objectarray_t *oa; /* result: array of Method-objects */
+ methodinfo *m; /* the current method to be represented */
s4 public_methods; /* number of public methods of the class */
s4 pos;
s4 i;
- c = (classinfo *) klass;
+ c = LLNI_classinfo_unwrap(klass);
+
public_methods = 0;
/* JOWENN: array classes do not declare methods according to mauve
clone method overriding instead of declaring it as a member
function. */
- if (_Jv_java_lang_Class_isArray(klass))
+ if (class_is_array(c))
return builtin_anewarray(0, class_java_lang_reflect_Method);
/* determine number of methods */
if (((m->flags & ACC_PUBLIC) || (publicOnly == false)) &&
((m->name != utf_init) && (m->name != utf_clinit)) &&
!(m->flags & ACC_MIRANDA)) {
+ /* create Method object */
- o = native_new_and_init(class_java_lang_reflect_Method);
-
- if (o == NULL)
- return NULL;
-
- /* initialize instance fields */
-
- rm = (java_lang_reflect_Method *) o;
-
-#if defined(WITH_CLASSPATH_GNU)
-
- rm->clazz = (java_lang_Class *) m->class;
-
- /* The name needs to be interned */
- /* XXX implement me better! */
-
- rm->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(m->name));
- rm->slot = i;
-
-#elif defined(WITH_CLASSPATH_SUN)
-
- rm->clazz = (java_lang_Class *) m->class;
-
- /* The name needs to be interned */
- /* XXX implement me better! */
-
- rm->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(m->name));
- rm->parameterTypes = method_get_parametertypearray(m);
- rm->returnType = (java_lang_Class *) method_returntype_get(m);
- rm->exceptionTypes = method_get_exceptionarray(m);
- rm->modifiers = m->flags & ACC_CLASS_REFLECT_MASK;
- rm->slot = i;
- rm->signature = m->signature ? (java_lang_String *) javastring_new(m->signature) : NULL;
- rm->annotations = NULL;
- rm->parameterAnnotations = NULL;
- rm->annotationDefault = NULL;
-
-#else
-# error unknown classpath configuration
-#endif
+ rm = reflect_method_new(m);
/* store object into array */
- oa->data[pos++] = o;
+ LLNI_objectarray_element_set(oa, pos, rm);
+ pos++;
}
}
* Method: getDeclaredConstructors
* Signature: (Z)[Ljava/lang/reflect/Constructor;
*/
-java_objectarray *_Jv_java_lang_Class_getDeclaredConstructors(java_lang_Class *klass, s4 publicOnly)
+java_handle_objectarray_t *_Jv_java_lang_Class_getDeclaredConstructors(java_lang_Class *klass, s4 publicOnly)
{
classinfo *c;
methodinfo *m; /* the current method to be represented */
- java_objectarray *oa; /* result: array of Method-objects */
- java_objectheader *o;
+ java_handle_objectarray_t *oa; /* result: array of Method-objects */
java_lang_reflect_Constructor *rc;
s4 public_methods; /* number of public methods of the class */
s4 pos;
s4 i;
- c = (classinfo *) klass;
+ c = LLNI_classinfo_unwrap(klass);
/* determine number of constructors */
if (((m->flags & ACC_PUBLIC) || (publicOnly == 0)) &&
(m->name == utf_init)) {
+ /* create Constructor object */
- o = native_new_and_init(class_java_lang_reflect_Constructor);
-
- if (o == NULL)
- return NULL;
-
- /* initialize instance fields */
-
- rc = (java_lang_reflect_Constructor *) o;
-
-#if defined(WITH_CLASSPATH_GNU)
-
- rc->clazz = (java_lang_Class *) c;
- rc->slot = i;
-
-#elif defined(WITH_CLASSPATH_SUN)
-
- rc->clazz = (java_lang_Class *) c;
- rc->parameterTypes = method_get_parametertypearray(m);
- rc->exceptionTypes = method_get_exceptionarray(m);
- rc->modifiers = m->flags & ACC_CLASS_REFLECT_MASK;
- rc->slot = i;
- rc->signature = m->signature ? (java_lang_String *) javastring_new(m->signature) : NULL;
- rc->annotations = NULL;
- rc->parameterAnnotations = NULL;
-
-#else
-# error unknown classpath configuration
-#endif
+ rc = reflect_constructor_new(m);
/* store object into array */
- oa->data[pos++] = o;
+ LLNI_objectarray_element_set(oa, pos, rc);
+ pos++;
}
}
{
classinfo *c;
- c = (classinfo *) klass;
+ c = LLNI_classinfo_unwrap(klass);
return (java_lang_ClassLoader *) c->classloader;
}
* Method: isArray
* Signature: ()Z
*/
-s4 _Jv_java_lang_Class_isArray(java_lang_Class *klass)
+JNIEXPORT int32_t JNICALL _Jv_java_lang_Class_isArray(JNIEnv *env, java_lang_Class *this)
{
classinfo *c;
- c = (classinfo *) klass;
-
- if (!(c->state & CLASS_LINKED))
- if (!link_class(c))
- return 0;
+ c = LLNI_classinfo_unwrap(this);
- return (c->vftbl->arraydesc != NULL);
+ return class_is_array(c);
}
*/
void _Jv_java_lang_Class_throwException(java_lang_Throwable *t)
{
- java_objectheader *o;
+ java_handle_t *o;
- o = (java_objectheader *) t;
+ o = (java_handle_t *) t;
exceptions_set_exception(o);
}
-#if 0
+#if defined(WITH_CLASSPATH_GNU) && defined(ENABLE_ANNOTATIONS)
/*
* Class: java/lang/Class
* Method: getDeclaredAnnotations
* Signature: (Ljava/lang/Class;)[Ljava/lang/annotation/Annotation;
*/
-java_objectarray *_Jv_java_lang_Class_getDeclaredAnnotations(java_lang_Class* klass)
+java_handle_objectarray_t *_Jv_java_lang_Class_getDeclaredAnnotations(java_lang_Class* klass)
{
-}
-#endif
+ classinfo *c = NULL;
+ static methodinfo *m_parseAnnotationsIntoArray = NULL;
+ utf *utf_parseAnnotationsIntoArray = NULL;
+ utf *utf_desc = NULL;
+ java_handle_bytearray_t *annotations = NULL;
+ sun_reflect_ConstantPool *constantPool = NULL;
+ java_lang_Object *constantPoolOop = (java_lang_Object*)klass;
+
+ if (klass == NULL) {
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ c = LLNI_classinfo_unwrap(klass);
+ /* get annotations: */
+ annotations = class_get_annotations(c);
-/*
- * Class: java/lang/Class
- * Method: getEnclosingClass
- * Signature: (Ljava/lang/Class;)Ljava/lang/Class;
- */
-java_lang_Class *_Jv_java_lang_Class_getEnclosingClass(java_lang_Class *klass)
-{
- classinfo *c;
- classref_or_classinfo cr;
- classinfo *ec;
-
- c = (classinfo *) klass;
+ if (exceptions_get_exception() != NULL) {
+ /* the only exception possible here should be a out of memory exception
+ * raised by copying the annotations into a java bytearray */
+ return NULL;
+ }
- /* get enclosing class */
+ constantPool =
+ (sun_reflect_ConstantPool*)native_new_and_init(
+ class_sun_reflect_ConstantPool);
+
+ if(constantPool == NULL) {
+ /* out of memory */
+ return NULL;
+ }
- cr = c->enclosingclass;
+ LLNI_field_set_ref(constantPool, constantPoolOop, constantPoolOop);
- if (cr.any == NULL)
- return NULL;
+ /* only resolve the method the first time */
+ if (m_parseAnnotationsIntoArray == NULL) {
+ utf_parseAnnotationsIntoArray = utf_new_char("parseAnnotationsIntoArray");
+ utf_desc = utf_new_char(
+ "([BLsun/reflect/ConstantPool;Ljava/lang/Class;)"
+ "[Ljava/lang/annotation/Annotation;");
- /* resolve the class if necessary */
+ if (utf_parseAnnotationsIntoArray == NULL || utf_desc == NULL) {
+ /* out of memory */
+ return NULL;
+ }
- if (IS_CLASSREF(cr)) {
- ec = resolve_classref_eager(cr.ref);
+ m_parseAnnotationsIntoArray = class_resolveclassmethod(
+ class_sun_reflect_annotation_AnnotationParser,
+ utf_parseAnnotationsIntoArray,
+ utf_desc,
+ class_java_lang_Class,
+ true);
- if (ec == NULL)
+ if (m_parseAnnotationsIntoArray == NULL) {
+ /* method not found */
return NULL;
+ }
}
- else
- ec = cr.cls;
- return (java_lang_Class *) ec;
+ return (java_handle_objectarray_t*)vm_call_method(
+ m_parseAnnotationsIntoArray, NULL,
+ annotations, constantPool, klass);
}
+#endif
/* _Jv_java_lang_Class_getEnclosingMethod_intern *******************************
static methodinfo *_Jv_java_lang_Class_getEnclosingMethod_intern(classinfo *c)
{
- classref_or_classinfo cr;
- constant_nameandtype *cn;
- classinfo *ec;
- methodinfo *m;
+ constant_nameandtype *cn;
+ classinfo *ec;
+ methodinfo *m;
/* get enclosing class and method */
- cr = c->enclosingclass;
+ ec = class_get_enclosingclass(c);
cn = c->enclosingmethod;
/* check for enclosing class and method */
- if (cr.any == NULL)
+ if (ec == NULL)
return NULL;
if (cn == NULL)
return NULL;
- /* resolve the class if necessary */
-
- if (IS_CLASSREF(cr)) {
- ec = resolve_classref_eager(cr.ref);
-
- if (ec == NULL)
- return NULL;
- }
- else
- ec = cr.cls;
-
/* find method in enclosing class */
m = class_findmethod(ec, cn->name, cn->descriptor);
{
classinfo *c;
methodinfo *m;
- java_objectheader *o;
java_lang_reflect_Constructor *rc;
- c = (classinfo *) klass;
+ c = LLNI_classinfo_unwrap(klass);
/* get enclosing method */
if (m->name != utf_init)
return NULL;
- /* create java.lang.reflect.Constructor object */
-
- o = native_new_and_init(class_java_lang_reflect_Constructor);
-
- if (o == NULL)
- return NULL;
-
- /* initialize instance fields */
-
- rc = (java_lang_reflect_Constructor *) o;
+ /* create Constructor object */
- rc->clazz = (java_lang_Class *) m->class;
- rc->slot = m - m->class->methods; /* calculate method slot */
+ rc = reflect_constructor_new(m);
return rc;
}
{
classinfo *c;
methodinfo *m;
- java_objectheader *o;
java_lang_reflect_Method *rm;
- c = (classinfo *) klass;
+ c = LLNI_classinfo_unwrap(klass);
/* get enclosing method */
/* create java.lang.reflect.Method object */
- o = native_new_and_init(class_java_lang_reflect_Method);
-
- if (o == NULL)
- return NULL;
-
- /* initialize instance fields */
-
- rm = (java_lang_reflect_Method *) o;
-
-#if defined(WITH_CLASSPATH_GNU)
- rm->clazz = (java_lang_Class *) m->class;
-#elif defined(WITH_CLASSPATH_SUN)
- rm->clazz = (java_lang_Class *) m->class;
-#else
-# error unknown classpath configuration
-#endif
-
- rm->name = (java_lang_String *) javastring_new(m->name);
- rm->slot = m - m->class->methods; /* calculate method slot */
+ rm = reflect_method_new(m);
return rm;
}
*/
java_lang_String *_Jv_java_lang_Class_getClassSignature(java_lang_Class* klass)
{
- classinfo *c;
- java_objectheader *o;
+ classinfo *c;
+ java_handle_t *o;
- c = (classinfo *) klass;
+ c = LLNI_classinfo_unwrap(klass);
if (c->signature == NULL)
return NULL;
return (java_lang_String *) o;
}
-
-#if 0
-/*
- * Class: java/lang/Class
- * Method: isAnonymousClass
- * Signature: (Ljava/lang/Class;)Z
- */
-s4 _Jv_java_lang_Class_isAnonymousClass(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
-
-
-/*
- * Class: java/lang/VMClass
- * Method: isLocalClass
- * Signature: (Ljava/lang/Class;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isLocalClass(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
-
-
-/*
- * Class: java/lang/VMClass
- * Method: isMemberClass
- * Signature: (Ljava/lang/Class;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isMemberClass(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
-#endif
-
#endif /* ENABLE_JAVASE */