RFR: 8349284: Make libExplicitAttach work on static JDK [v2]

Jiangli Zhou jiangli at openjdk.org
Mon Feb 10 03:53:09 UTC 2025


On Sat, 8 Feb 2025 09:29:48 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> Is the JavaVM param passed to JNI_OnLoad usable in static builds? If so then this just needs to be saved, no need to use GetCreatedJavaVMs, right?

Yes, on static JDK, `JNI_OnLoad`'s `JavaVM *` argument behaves the same as on regular JDK. It points to the current VM. IIUC, `libExplicitAttach.c` does not appear to explicitly test `JNI_GetCreatedJavaVMs`, but only calls it to retrieve the VM. Removing the `JNI_GetCreatedJavaVMs` call can result a cleaner fix. Thanks for pointing that out.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23500#discussion_r1948363497


More information about the build-dev mailing list