jni-rs v0.20.0 Release Notes

Release Date: 2022-10-17 // over 1 year ago
  • โž• Added

    • 0๏ธโƒฃ Default trait implemented for JObject, JString, JClass, and JByteBuffer (#199)
    • ๐Ÿš€ Debug trait implemented for JavaVM, GlobalRef, GlobalRefGuard, JStaticMethodID and ReleaseMode (#345)
    • ReturnType for specifying object return types without a String allocation. (#329)

    ๐Ÿ”„ Changed

    • The release_string_utf_chars function has been marked as unsafe. (#334)
    • Mark JNIEnv::new_direct_byte_buffer as unsafe (#320)
    • JNIEnv::new_direct_byte_buffer now takes a raw pointer and size instead of a slice (#351 and #364)
    • JNIEnv::direct_buffer_address returns a raw pointer instead of a slice (#364)
    • The lifetime of AutoArray is no longer tied to the lifetime of a particular JNIEnv reference. (#302)
    • Relaxed lifetime restrictions on JNIEnv::new_local_ref. Now it can be used to create a local reference from a global reference. (#301 / #319)
    • ๐Ÿ”€ JMethodID and JStaticMethodID implement Send + Sync and no longer has a lifetime parameter, making method IDs cacheable (with a documented 'Safety' note about ensuring they remain valid). (#346)
    • ๐Ÿ”€ JFieldID and JStaticFieldID implement Send + Sync and no longer has a lifetime parameter, making field IDs cacheable (with a documented 'Safety' note about ensuring they remain valid). (#346)
    • The call_*_method_unchecked functions now take jni:sys::jvalue arguments to avoid allocating a Vec on each call to map + collect JValues as sys:jvalues (#329)
    • ๐Ÿ‘ท The From trait implementations converting jni_sys types like jobject to JObject have been replaced with unsafe ::from_raw functions and corresponding ::into_raw methods. Existing ::into_inner APIs were renamed ::into_raw for symmetry. (#197)
    • The APIs JNIEnv::set_rust_field, JNIEnv::get_rust_field and JNIEnv::take_rust_field have been marked as unsafe (#219)

Previous changes from v0.19.0

  • โž• Added

    • AutoArray and generic get_array_elements(), along with get_<type>_array_elements helpers. (#287)
    • size() method to AutoArray and AutoPrimitiveArray. (#278 / #287)
    • discard() method to AutoArray and AutoPrimitiveArray. (#275 / #287)

    ๐Ÿ”„ Changed

    • โœ‚ Removed AutoPrimitiveArray::commit(). (#290)
    • AutoByte/PrimitiveArray.commit() now returns Result. (#275)
    • Removed methods get/release/commit_byte/primitive_array_{elements|critical}. (#281)
    • Renamed methods get_auto_byte/long/primitive_array_{elements|critical} to get_byte/long/primitive_array_{elements|critical}. (#281)