-
Enhancement
-
Resolution: Fixed
-
P4
-
17
-
b08
The following code was necessary when we had HSX, where a JDK can use different versions of libjvm.so, as long as they all support the same JVM_INTERFACE_VERSION.
https://github.com/openjdk/jdk/blob/35c9da70316da21a6be2fd92a5e5b5f193bdd9d6/src/java.base/share/native/libjava/check_version.c#L31
JNIEXPORT jint JNICALL
DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
{
jint vm_version = JVM_GetInterfaceVersion();
if (vm_version != JVM_INTERFACE_VERSION) {
JNIEnv *env;
char buf[128];
sprintf(buf, "JVM interface version mismatch: expecting %d, got %d.",
JVM_INTERFACE_VERSION, (int)vm_version);
(*vm)->GetEnv(vm, (void **)&env, JNI_VERSION_1_2);
if (env) {
(*env)->FatalError(env, buf);
}
}
return JNI_VERSION_1_2;
}
HSX is no longer supported, and we have been modifying the APIs exposed by jvm.h without updating JVM_INTERFACE_VERSION.
JVM_GetInterfaceVersion() and JVM_INTERFACE_VERSION, etc, should be removed.
Also, implementations of APIs such as JVM_DTraceActivate, were removed inJDK-8068976, so their declarations should be removed from jvm.h
https://github.com/openjdk/jdk/blob/35c9da70316da21a6be2fd92a5e5b5f193bdd9d6/src/java.base/share/native/libjava/check_version.c#L31
JNIEXPORT jint JNICALL
DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
{
jint vm_version = JVM_GetInterfaceVersion();
if (vm_version != JVM_INTERFACE_VERSION) {
JNIEnv *env;
char buf[128];
sprintf(buf, "JVM interface version mismatch: expecting %d, got %d.",
JVM_INTERFACE_VERSION, (int)vm_version);
(*vm)->GetEnv(vm, (void **)&env, JNI_VERSION_1_2);
if (env) {
(*env)->FatalError(env, buf);
}
}
return JNI_VERSION_1_2;
}
HSX is no longer supported, and we have been modifying the APIs exposed by jvm.h without updating JVM_INTERFACE_VERSION.
JVM_GetInterfaceVersion() and JVM_INTERFACE_VERSION, etc, should be removed.
Also, implementations of APIs such as JVM_DTraceActivate, were removed in