#include "native/jni.h"
#include "native/native.h"
#include "native/include/java_lang_Class.h"
-#include "native/include/java_lang_ClassLoader.h"
#include "native/include/java_lang_Object.h"
-#include "native/include/java_lang_VMClass.h"
-#include "native/include/java_lang_reflect_Constructor.h"
-#include "native/include/java_lang_reflect_Field.h"
-#include "native/include/java_lang_reflect_Method.h"
-#include "native/include/java_security_ProtectionDomain.h"
+
+#if defined(ENABLE_JAVASE)
+# include "native/include/java_lang_ClassLoader.h"
+# include "native/include/java_lang_reflect_Constructor.h"
+# include "native/include/java_lang_reflect_Field.h"
+# include "native/include/java_lang_reflect_Method.h"
+#endif
+
#include "native/vm/java_lang_Class.h"
#include "toolbox/logging.h"
#include "vm/builtin.h"
#include "vm/stringlocal.h"
+/*
+ * Class: java/lang/Class
+ * Method: getName
+ * Signature: ()Ljava/lang/String;
+ */
+java_lang_String *_Jv_java_lang_Class_getName(java_lang_Class *klass)
+{
+ classinfo *c;
+ java_lang_String *s;
+ u4 i;
+
+ c = (classinfo *) klass;
+
+ /* create a java string */
+
+ s = (java_lang_String *) javastring_new(c->name);
+
+ if (s == NULL)
+ return NULL;
+
+ /* return string where '/' is replaced by '.' */
+
+ for (i = 0; i < s->value->header.size; i++) {
+ if (s->value->data[i] == '/')
+ s->value->data[i] = '.';
+ }
+
+ return s;
+}
+
+
+/*
+ * Class: java/lang/Class
+ * Method: forName
+ * Signature: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;
+ */
+#if defined(ENABLE_JAVASE)
+java_lang_Class *_Jv_java_lang_Class_forName(java_lang_String *name, s4 initialize, java_lang_ClassLoader *loader)
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+java_lang_Class *_Jv_java_lang_Class_forName(java_lang_String *name)
+#endif
+{
+ classinfo *c;
+ utf *u;
+ u2 *pos;
+ s4 i;
+
+ /* illegal argument */
+
+ if (name == NULL) {
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ /* name must not contain '/' (mauve test) */
+
+ for (i = 0, pos = name->value->data + name->offset; i < name->count; i++, pos++) {
+ if (*pos == '/') {
+ *exceptionptr =
+ new_exception_javastring(string_java_lang_ClassNotFoundException, name);
+ return NULL;
+ }
+ }
+
+ /* create utf string in which '.' is replaced by '/' */
+
+ u = javastring_toutf(name, true);
+
+ /* try to load, ... */
+
+#if defined(ENABLE_JAVASE)
+ if (!(c = load_class_from_classloader(u, (java_objectheader *) loader))) {
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+ if (!(c = load_class_bootstrap(u))) {
+#endif
+ classinfo *xclass;
+
+ xclass = (*exceptionptr)->vftbl->class;
+
+ /* if the exception is a NoClassDefFoundError, we replace it with a
+ ClassNotFoundException, otherwise return the exception */
+
+ if (xclass == class_java_lang_NoClassDefFoundError) {
+ /* clear exceptionptr, because builtin_new checks for
+ ExceptionInInitializerError */
+ *exceptionptr = NULL;
+
+ *exceptionptr =
+ new_exception_javastring(string_java_lang_ClassNotFoundException, name);
+ }
+
+ return NULL;
+ }
+
+ /* link, ... */
+
+ if (!link_class(c))
+ return NULL;
+
+ /* ...and initialize it, if required */
+
+#if defined(ENABLE_JAVASE)
+ if (initialize)
+#endif
+ if (!initialize_class(c))
+ return NULL;
+
+ return (java_lang_Class *) c;
+}
+
+
+#if defined(ENABLE_JAVASE)
+
/*
* Class: java/lang/Class
* Method: isInstance
}
-/*
- * Class: java/lang/Class
- * Method: getName
- * Signature: ()Ljava/lang/String;
- */
-java_lang_String *_Jv_java_lang_Class_getName(java_lang_Class *klass)
-{
- classinfo *c;
- java_lang_String *s;
- u4 i;
-
- c = (classinfo *) klass;
-
- /* create a java string */
-
- s = (java_lang_String *) javastring_new(c->name);
-
- if (s == NULL)
- return NULL;
-
- /* return string where '/' is replaced by '.' */
-
- for (i = 0; i < s->value->header.size; i++) {
- if (s->value->data[i] == '/')
- s->value->data[i] = '.';
- }
-
- return s;
-}
-
-
/*
* Class: java/lang/Class
* Method: getSuperclass
}
-/*
- * Class: java/lang/VMClass
- * Method: forName
- * Signature: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;
- */
-java_lang_Class *_Jv_java_lang_Class_forName(java_lang_String *name, s4 initialize, java_lang_ClassLoader *loader)
-{
- classinfo *c;
- utf *u;
- u2 *pos;
- s4 i;
-
- /* illegal argument */
-
- if (name == NULL) {
- exceptions_throw_nullpointerexception();
- return NULL;
- }
-
- /* name must not contain '/' (mauve test) */
-
- for (i = 0, pos = name->value->data + name->offset; i < name->count; i++, pos++) {
- if (*pos == '/') {
- *exceptionptr =
- new_exception_javastring(string_java_lang_ClassNotFoundException, name);
- return NULL;
- }
- }
-
- /* create utf string in which '.' is replaced by '/' */
-
- u = javastring_toutf(name, true);
-
- /* try to load, ... */
-
- if (!(c = load_class_from_classloader(u, (java_objectheader *) loader))) {
- classinfo *xclass;
-
- xclass = (*exceptionptr)->vftbl->class;
-
- /* if the exception is a NoClassDefFoundError, we replace it with a
- ClassNotFoundException, otherwise return the exception */
-
- if (xclass == class_java_lang_NoClassDefFoundError) {
- /* clear exceptionptr, because builtin_new checks for
- ExceptionInInitializerError */
- *exceptionptr = NULL;
-
- *exceptionptr =
- new_exception_javastring(string_java_lang_ClassNotFoundException, name);
- }
-
- return NULL;
- }
-
- /* link, ... */
-
- if (!link_class(c))
- return NULL;
-
- /* ...and initialize it, if required */
-
- if (initialize)
- if (!initialize_class(c))
- return NULL;
-
- return (java_lang_Class *) c;
-}
-
-
/*
* Class: java/lang/Class
* Method: isArray
JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isMemberClass(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
#endif
+#endif /* ENABLE_JAVASE */
+
/*
* These are local overrides for various environment variables in Emacs.
#include "native/jni.h"
#include "native/include/java_lang_Class.h"
-#include "native/include/java_lang_ClassLoader.h"
#include "native/include/java_lang_Object.h"
-#include "native/include/java_lang_String.h"
-#include "native/include/java_lang_Throwable.h"
-#include "native/include/java_lang_reflect_Constructor.h"
-#include "native/include/java_lang_reflect_Method.h"
+
+#if defined(ENABLE_JAVASE)
+# include "native/include/java_lang_ClassLoader.h"
+# include "native/include/java_lang_String.h"
+# include "native/include/java_lang_Throwable.h"
+# include "native/include/java_lang_reflect_Constructor.h"
+# include "native/include/java_lang_reflect_Method.h"
+#endif
/* function prototypes ********************************************************/
+java_lang_String *_Jv_java_lang_Class_getName(java_lang_Class *klass);
+
+#if defined(ENABLE_JAVASE)
+java_lang_Class *_Jv_java_lang_Class_forName(java_lang_String *name, s4 initialize, java_lang_ClassLoader *loader);
s4 _Jv_java_lang_Class_isInstance(java_lang_Class *klass, java_lang_Object *o);
s4 _Jv_java_lang_Class_isAssignableFrom(java_lang_Class *klass, java_lang_Class *c);
s4 _Jv_java_lang_Class_isInterface(java_lang_Class *klass);
s4 _Jv_java_lang_Class_isPrimitive(java_lang_Class *klass);
-java_lang_String *_Jv_java_lang_Class_getName(java_lang_Class *klass);
java_lang_Class *_Jv_java_lang_Class_getSuperclass(java_lang_Class *klass);
java_objectarray *_Jv_java_lang_Class_getInterfaces(java_lang_Class *klass);
java_lang_Class *_Jv_java_lang_Class_getComponentType(java_lang_Class *klass);
java_objectarray *_Jv_java_lang_Class_getDeclaredMethods(java_lang_Class *klass, s4 publicOnly);
java_objectarray *_Jv_java_lang_Class_getDeclaredConstructors(java_lang_Class *klass, s4 publicOnly);
java_lang_ClassLoader *_Jv_java_lang_Class_getClassLoader(java_lang_Class *klass);
-java_lang_Class *_Jv_java_lang_Class_forName(java_lang_String *name, s4 initialize, java_lang_ClassLoader *loader);
s4 _Jv_java_lang_Class_isArray(java_lang_Class *klass);
void _Jv_java_lang_Class_throwException(java_lang_Throwable *t);
JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isLocalClass(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isMemberClass(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
#endif
+#endif /* ENABLE_JAVASE */
+
+#if defined(ENABLE_JAVAME_CLDC1_1)
+java_lang_Class *_Jv_java_lang_Class_forName(java_lang_String *name);
+#endif
#endif /* _JV_JAVA_LANG_CLASS_H */
#include "native/jni.h"
#include "native/native.h"
#include "native/include/java_lang_Class.h"
-#include "native/include/java_lang_Cloneable.h"
+
+#if defined(ENABLE_JAVASE)
+# include "native/include/java_lang_Cloneable.h"
+#endif
+
#include "native/include/java_lang_Object.h"
#if defined(ENABLE_THREADS)
}
-/*
- * Class: java/lang/Object
- * Method: clone
- * Signature: (Ljava/lang/Cloneable;)Ljava/lang/Object;
- */
-java_lang_Object *_Jv_java_lang_Object_clone(java_lang_Cloneable *this)
-{
- java_objectheader *o;
- java_objectheader *co;
-
- o = (java_objectheader *) this;
-
- co = builtin_clone(NULL, o);
-
- return (java_lang_Object *) co;
-}
-
-
/*
* Class: java/lang/Object
* Method: notify
}
+#if defined(ENABLE_JAVASE)
+
+/*
+ * Class: java/lang/Object
+ * Method: clone
+ * Signature: (Ljava/lang/Cloneable;)Ljava/lang/Object;
+ */
+java_lang_Object *_Jv_java_lang_Object_clone(java_lang_Cloneable *this)
+{
+ java_objectheader *o;
+ java_objectheader *co;
+
+ o = (java_objectheader *) this;
+
+ co = builtin_clone(NULL, o);
+
+ return (java_lang_Object *) co;
+}
+
+#endif /* ENABLE_JAVASE */
+
+
/*
* 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
/* function prototypes ********************************************************/
java_lang_Class *_Jv_java_lang_Object_getClass(java_lang_Object *obj);
-java_lang_Object *_Jv_java_lang_Object_clone(java_lang_Cloneable *this);
void _Jv_java_lang_Object_notify(java_lang_Object *this);
void _Jv_java_lang_Object_notifyAll(java_lang_Object *this);
void _Jv_java_lang_Object_wait(java_lang_Object *o, s8 ms, s4 ns);
+#if defined(ENABLE_JAVASE)
+
+java_lang_Object *_Jv_java_lang_Object_clone(java_lang_Cloneable *this);
+
+#endif
+
#endif /* _JV_JAVA_LANG_OBJECT_H */
#include "native/jni.h"
#include "native/native.h"
-#include "native/include/java_lang_ThreadGroup.h"
+
+#if defined(ENABLE_JAVASE)
+# include "native/include/java_lang_ThreadGroup.h"
+#endif
+
#include "native/include/java_lang_Object.h" /* java_lang_Thread.h */
#include "native/include/java_lang_Throwable.h" /* java_lang_Thread.h */
#include "native/include/java_lang_Thread.h"
#endif
#include "toolbox/logging.h"
+#include "vm/builtin.h"
+#include "vm/exceptions.h"
#include "vm/options.h"
}
+/*
+ * Class: java/lang/Thread
+ * Method: sleep
+ * Signature: (J)V
+ */
+void _Jv_java_lang_Thread_sleep(s8 millis)
+{
+#if defined(ENABLE_THREADS)
+ threads_sleep(millis, 0);
+#endif
+}
+
+
/*
* Class: java/lang/Thread
* Method: start
thread = (threadobject *) this;
return threads_thread_has_been_interrupted(thread);
+#else
+ return 0;
#endif
}
*/
java_lang_Thread *_Jv_java_lang_Thread_currentThread(void)
{
+#if defined(ENABLE_THREADS)
threadobject *thread;
+#endif
java_lang_Thread *t;
#if defined(ENABLE_THREADS)
if (t == NULL)
log_text("t ptr is NULL\n");
+# if defined(ENABLE_JAVASE)
if (t->group == NULL) {
/* ThreadGroup of currentThread is not initialized */
if (t->group == NULL)
log_text("unable to create ThreadGroup");
}
+# endif
#else
/* we just return a fake java.lang.Thread object, otherwise we get
NullPointerException's in GNU classpath */
{
#if defined(ENABLE_THREADS)
return threads_check_if_interrupted_and_reset();
+#else
+ return 0;
#endif
}
if (o == NULL) {
exceptions_throw_nullpointerexception();
- return;
+ return 0;
}
return lock_is_held_by_current_thread(o);
+#else
+ return 0;
#endif
}
#include "native/jni.h"
#include "native/include/java_lang_String.h"
-#include "native/include/java_lang_ThreadGroup.h"
#include "native/include/java_lang_Object.h" /* java_lang_Thread.h */
#include "native/include/java_lang_Throwable.h" /* java_lang_Thread.h */
-#include "native/include/java_lang_VMThread.h"
#include "native/include/java_lang_Thread.h"
+#if defined(ENABLE_JAVASE)
+# include "native/include/java_lang_ThreadGroup.h"
+#endif
+
+#if defined(WITH_CLASSPATH_GNU)
+# include "native/include/java_lang_VMThread.h"
+#endif
+
#include "threads/native/threads.h"
/* function prototypes ********************************************************/
s4 _Jv_java_lang_Thread_countStackFrames(java_lang_Thread *this);
+void _Jv_java_lang_Thread_sleep(s8 millis);
void _Jv_java_lang_Thread_start(java_lang_Thread *this, s8 stacksize);
void _Jv_java_lang_Thread_interrupt(java_lang_Thread *this);
s4 _Jv_java_lang_Thread_isInterrupted(java_lang_Thread *this);