RFR: 8354898: jdk/internal/loader/NativeLibraries/Main.java fails on static JDK
Jaikiran Pai
jpai at openjdk.org
Wed Apr 23 01:13:39 UTC 2025
On Wed, 16 Apr 2025 23:41:40 GMT, Jiangli Zhou <jiangli at openjdk.org> wrote:
> Please review this simple test change that skips the test case loading using JDK `libzip.so` on static JDK in test/jdk/jdk/internal/loader/NativeLibraries/Main.java. AFAICT, the test case using `NativeLibrariesTest.LIB_NAME` (`libnativeLibrariesTest.so`) can provide coverage on static JDK.
>
> Thanks
Marked as reviewed by jpai (Reviewer).
Thank you Jiangli for the details in the JBS issue. That helped. Having read the documentation of `jdk.internal.loader.RawNativeLibraries` yesterday:
* RawNativeLibraries has the following properties:
* 1. Native libraries loaded in this RawNativeLibraries instance are
* not JNI native libraries. Hence JNI_OnLoad and JNI_OnUnload will
* be ignored. No support for linking of native method.
```
I mistook that it cannot be used to load JNI libraries and that's what confused me about this test since `libzip` is a JNI library. But reading this text again, I now realize that it can be used to load a JNI native library, but the loaded library won't be treated as a JNI library by `RawNativeLibraries`. So the usage of `libzip` in that test seems OK. I further looked at the change which introduced this usage in that test to understand if it was intentional to use a JNI library here. It appears that it was introduced in https://bugs.openjdk.org/browse/JDK-8281335 and so was an intentional decision to use a JNI library.
Given all this, I think the proposal to skip this loading for static JDK seems reasonable to me.
-------------
PR Review: https://git.openjdk.org/jdk/pull/24704#pullrequestreview-2785715732
PR Comment: https://git.openjdk.org/jdk/pull/24704#issuecomment-2822818016
More information about the core-libs-dev
mailing list