From: Michael Starzinger Date: Thu, 5 Mar 2009 15:13:32 +0000 (+0100) Subject: * src/native/jni.hpp (JNI_VERSION_CACAO): Added to be able to reveal ourselves. X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;ds=sidebyside;h=00ede7aa33c9dd86b472f8a3f36b20be83245190;p=cacao.git * src/native/jni.hpp (JNI_VERSION_CACAO): Added to be able to reveal ourselves. * src/native/jni.cpp (JNI_GetDefaultJavaVMInitArgs): Now accepts above version number. --- diff --git a/src/native/jni.cpp b/src/native/jni.cpp index 1f3bb40d2..e048a216d 100644 --- a/src/native/jni.cpp +++ b/src/native/jni.cpp @@ -793,9 +793,7 @@ jint _Jv_JNI_GetVersion(JNIEnv *env) { TRACEJNICALLS(("_Jv_JNI_GetVersion(env=%p)", env)); - /* We support JNI 1.6. */ - - return JNI_VERSION_1_6; + return JNI_VERSION_SUPPORTED; } @@ -4125,22 +4123,28 @@ jint JNI_GetDefaultJavaVMInitArgs(void *vm_args) /* GNU classpath currently supports JNI 1.2 */ switch (_vm_args->version) { - case JNI_VERSION_1_1: + case JNI_VERSION_1_1: _vm_args->version = JNI_VERSION_1_1; break; - case JNI_VERSION_1_2: - case JNI_VERSION_1_4: + case JNI_VERSION_1_2: + case JNI_VERSION_1_4: _vm_args->ignoreUnrecognized = JNI_FALSE; _vm_args->options = NULL; _vm_args->nOptions = 0; break; - default: - return -1; + case JNI_VERSION_CACAO: + // We reveal ourselves by accepting this version number, + // this actually means we are using the supported JNI version. + _vm_args->version = JNI_VERSION_SUPPORTED; + break; + + default: + return JNI_ERR; } - - return 0; + + return JNI_OK; } diff --git a/src/native/jni.hpp b/src/native/jni.hpp index 16933eca1..e26aca44f 100644 --- a/src/native/jni.hpp +++ b/src/native/jni.hpp @@ -78,6 +78,12 @@ //#include "vm/javaobjects.hpp" #include "vm/global.h" + +// Some additional JNI version numbers, we currently support JNI 1.6. +#define JNI_VERSION_SUPPORTED JNI_VERSION_1_6 +#define JNI_VERSION_CACAO 0xcaca0000 + + // Typedef the JNI types. typedef java_handle_t* jobject; typedef java_handle_t* jclass;