It's alive! π
It's been about 6 years since the last release and although that's generally been OK, since the JNI API doesn't change that frequently, there have been a number of paper cuts adding up that this release hopefully helps to address.
Thanks to @sfackler for transferring the repo to the https://github.com/jni-rs Github organisation where we can hopefully keep the flame alive.
The most notable changes are that jboolean
is now an alias for bool
and that JNINativeInterface_
is now a union that namespaces the functions based on the JNI version when each function was added to the spec. Please see below for more details.
Added
- Added
JNI_VERSION_9
,JNI_VERSION_10
,JNI_VERSION_19
,JNI_VERSION_20
andJNI_VERSION_21
constants - Added
GetModule()
toJNINativeInterface
(#22) IsVirtualThread()
toJNINativeInterface
(#32)- Implemented
Debug
trait for all types (#31) - Added support for
no_std
environments (#12)
Changed
-
jboolean
is now an alias forbool
instead ofu8
(#23) -
The
JNIInvokeInterface_
andJNINativeInterface_
structs were turned into unions that namespace functions by version (#28):This makes it much clearer what version of JNI you require to access any function safely.
So instead of a struct like:
struct JNINativeInterface_ { pub reserved0: *mut c_void, .. pub GetVersion: unsafe extern "system" fn(env: *mut JNIEnv) -> jint, .. pub NewLocalRef: unsafe extern "system" fn(env: *mut JNIEnv, ref_: jobject) -> jobject, }
there is now a union like:
union JNINativeInterface_ { v1_1: JNINativeInterface__1_1, v1_2: JNINativeInterface__1_2, reserved: JNINativeInterface__reserved, }
And you can access
GetVersion
like:env.v1_1.GetVersion
and accessNewLocalRef
like:env.v1_2.NewLocalRef
.Each version struct includes all functions for that version and lower, so it's also possible to access
GetVersion
likeenv.v1_2.GetVersion
. -
Function pointers are no longer wrapped in an
Option<>
(#25)
New Contributors
- @marschall made their first contribution in #9
- @CertainLach made their first contribution in #12
- @morristai made their first contribution in #15
Full Changelog: v0.3.0...v0.4.0