Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_Class.c 8341 2007-08-17 21:32:01Z michi $
-
*/
#endif
#include "native/vm/java_lang_Class.h"
-#include "native/vm/java_lang_String.h"
#if defined(ENABLE_JAVASE)
# include "native/vm/reflect.h"
#include "vmcore/loader.h"
#if defined(WITH_CLASSPATH_GNU) && defined(ENABLE_ANNOTATIONS)
+#include "native/include/sun_reflect_ConstantPool.h"
+
#include "vm/vm.h"
+
#include "vmcore/annotation.h"
-#include "native/include/sun_reflect_ConstantPool.h"
#endif
/*
*/
java_lang_String *_Jv_java_lang_Class_getName(java_lang_Class *klass)
{
- classinfo *c;
- java_lang_String *s;
- java_chararray_t *ca;
- u4 i;
+ classinfo *c;
+ java_lang_String *s;
+ java_handle_chararray_t *ca;
+ u4 i;
c = LLNI_classinfo_unwrap(klass);
s4 i;
#if defined(ENABLE_JAVASE)
- cl = (classloader *) loader;
+ cl = loader_hashtable_classloader_add((java_handle_t *) loader);
#endif
/* illegal argument */
}
-/*
- * Class: java/lang/Class
- * Method: getDeclaringClass
- * Signature: ()Ljava/lang/Class;
- */
-java_lang_Class *_Jv_java_lang_Class_getDeclaringClass(java_lang_Class *klass)
-{
- classinfo *c;
- classinfo *dc;
-
- c = LLNI_classinfo_unwrap(klass);
-
- dc = class_get_declaringclass(c);
-
- return LLNI_classinfo_wrap(dc);
-}
-
-
/*
* Class: java/lang/Class
* Method: getDeclaredClasses
}
-/*
- * Class: java/lang/Class
- * Method: getClassLoader
- * Signature: ()Ljava/lang/ClassLoader;
- */
-java_lang_ClassLoader *_Jv_java_lang_Class_getClassLoader(java_lang_Class *klass)
-{
- classinfo *c;
-
- c = LLNI_classinfo_unwrap(klass);
-
- return (java_lang_ClassLoader *) c->classloader;
-}
-
-#endif /* defined(ENABLE_JAVASE) */
-
-
-/*
- * Class: java/lang/Class
- * Method: isArray
- * Signature: ()Z
- */
-JNIEXPORT int32_t JNICALL _Jv_java_lang_Class_isArray(JNIEnv *env, java_lang_Class *this)
-{
- classinfo *c;
-
- c = LLNI_classinfo_unwrap(this);
-
- return class_is_array(c);
-}
-
-
-#if defined(ENABLE_JAVASE)
-
/*
* Class: java/lang/Class
* Method: throwException
*/
java_handle_objectarray_t *_Jv_java_lang_Class_getDeclaredAnnotations(java_lang_Class* klass)
{
- classinfo *c = LLNI_classinfo_unwrap(klass);
+ 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;
- uint32_t size = 0;
java_lang_Object *constantPoolOop = (java_lang_Object*)klass;
- if (c == NULL) {
+ if (klass == NULL) {
exceptions_throw_nullpointerexception();
return NULL;
}
- /* Return null for arrays and primitives: */
- if (class_is_primitive(c) || class_is_array(c)) {
- return NULL;
- }
-
- if (c->annotations != NULL) {
- size = c->annotations->size;
- annotations = builtin_newarray_byte(size);
+ c = LLNI_classinfo_unwrap(klass);
- if(annotations != NULL) {
- MCOPY(annotations->data, c->annotations->data, uint8_t, size);
- }
- }
+ /* get annotations: */
+ annotations = class_get_annotations(c);
constantPool =
(sun_reflect_ConstantPool*)native_new_and_init(