On Thu, 8 Oct 2026 19:56:46 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, except Android and WebKit.
>>
>> - 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 incrementally with one additional
> commit since the last revision:
>
> revert whitespace change
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_6);
This code is currently unused. Iirc, its intention is to start an embedded JVM,
instead of using the Android Java runtime. In that case, it is very unlikely
that anyone wants to build and embed a JVM that doesn't have JNI_VERSION_1_6,
so I don't see problems with this here.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2175#discussion_r4228551613