On Sun, 27 Sep 2026 11:36:06 GMT, Marius Hanl <[email protected]> wrote:

>> This replaces all `JNI_VERSION` version strings with `JNI_VERSION_1_8`.
>> All of JavaFX is `JNI_VERSION_1_8` now.
>> 
>> - Tested with JLink+JPackage (with and without JMods)
>> - Tested with GraalVM (newest version 25, 25.1 and 25.4)
>> 
>> Sometimes this allowed to replace code that was always built like this:
>> 
>> 
>> #ifdef JNI_VERSION_1_8
>>     //min. returned JNI_VERSION required by JDK8 for builtin libraries
>>     JNIEnv *env;
>>     if ((*vm)->GetEnv(vm, (void **)&env, JNI_VERSION_1_8) != JNI_OK) {
>>         return JNI_VERSION_1_4;
>>     }
>>    ...
>> 
>> 
>> with:
>> 
>> return JNI_VERSION_1_8;
>> 
>> 
>> **Question -> Will do as Follow-up** 
>> 
>> ~There are a few locations where we have the following pattern;~
>> 
>>     if (jvm->GetEnv((void **)&env, JNI_VERSION_1_8)) {
>>         return JNI_ERR; /* JNI version not supported */
>>     }
>> 
>> ~which should not happen anymore, right? 
>> Most of the code locations do not have this check and just do:~
>> 
>> jvm->GetEnv(&env, JNI_VERSION_1_8);
>> 
>> ~Should I follow that pattern for the few locations left?~
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Marius Hanl has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains six commits:
> 
>  - remove comment
>  - Merge branch 'master' of https://github.com/openjdk/jfx into 
> JDK-8385270-Bump-JNI_VERSION-to-1.8-everywhere
>  - assign javavm
>  - Merge branch 'master' of https://github.com/openjdk/jfx into 
> JDK-8385270-Bump-JNI_VERSION-to-1.8-everywhere
>    
>    # Conflicts:
>    #  modules/javafx.graphics/src/main/native-iio/jpegloader.c
>  - Merge branch 'master' of https://github.com/openjdk/jfx into 
> JDK-8385270-Bump-JNI_VERSION-to-1.8-everywhere
>  - 8385270: Bump JNI_VERSION to 1.8 everywhere

The changes in the desktop JNI code looks fine. I'm running a CI build and will 
report results.

NOTE: we keep the native code in `modules/javafx.web/src/main/native` 100% 
identical across all code lines. Once this goes into mainline, I would ask you 
to backport at least the native WebKit changes to jfx27u.

@johanvos will need to review the Android, iOS, and Monocle EGL changes. I have 
a specific concern about the Android changes. A quick Google search suggests 
that Android does not support JNI_1_8.

modules/javafx.graphics/src/android/native/VMLauncher.c line 60:

> 58:     __android_log_print(3,"JVM", "JNI_OnLoad calling GetEnv()");
> 59:     JNIEnv* env = NULL;
> 60:     (*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_8);

A quick Google search suggests that Android does not support JNI_1_8.

modules/javafx.graphics/src/dalvik/native/activity.c line 79:

> 77:     jvm = vm;
> 78:     JNIEnv *env;
> 79:     if ((*vm)->GetEnv(vm, (void **) &env, JNI_VERSION_1_8)) {

Same question about Android seemingly not supporting this change.

modules/javafx.web/src/android/native/android_webview.c line 55:

> 53:     LOGV(TAG, "ONLOAD WEB");
> 54:     LOGI("ONLOAD WEB");
> 55:     if ((*vm)->GetEnv(vm, (void **) &env, JNI_VERSION_1_8)) {

Same question about Android.

-------------

PR Review: https://git.openjdk.org/jfx/pull/2175#pullrequestreview-5448395665
PR Review Comment: https://git.openjdk.org/jfx/pull/2175#discussion_r4212017165
PR Review Comment: https://git.openjdk.org/jfx/pull/2175#discussion_r4212031023
PR Review Comment: https://git.openjdk.org/jfx/pull/2175#discussion_r4212094577

Reply via email to