Merged with michi branch at rev 1684fe51cf3d.
[cacao.git] / src / native / jni.cpp
index 34c090d4c0814c8171862a0358df4481579831fe..d33892469c10a7621c96efdc14b6e8dd2a921708 100644 (file)
@@ -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;
 }
 
 
@@ -4118,22 +4116,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;
 }