cargo jni 0.11.0
Rust JNI 0.11.0

latest releases: 0.21.1, 0.21.0, 0.20.0...
5 years ago

Highlights

This release brings various improvements and fixes, outlined below. The most notable changes are:

  • ⚠️ null is no longer represented as an Err with error kind NullPtr if it is a value of some
    nullable Java reference (not an indication of an error). Related issues: #136, #148, #163.
  • unsafe methods, providing a low-level API similar to JNI, has been marked safe and renamed
    to have _unchecked suffix. Such methods can be used to implement caching of class references
    and method IDs to improve performance in loops and frequently called Java callbacks.
    If you have such, check out the docs and one of early usages
    of this feature.

Added

  • Invocation API support on Windows and AppVeyor CI (#149)

Changed

  • push_local_frame, delete_global_ref and release_string_utf_chars
    no longer check for exceptions as they are safe
    to call if there is a pending exception (#124):

    • push_local_frame will now work in case of pending exceptions — as
      the spec requires; and fail in case of allocation errors
    • delete_global_ref and release_string_utf_chars won't print incorrect
      log messages
  • Rename some macros to better express their intent (see #123):

    • Rename jni_call to jni_non_null_call as it checks the return value
      to be non-null.
    • Rename jni_non_null_call (which may return nulls) to jni_non_void_call.
  • A lot of public methods of JNIEnv have been marked as safe, all unsafe code
    has been isolated inside internal macros. Methods with _unsafe suffixes have
    been renamed and now have _unchecked suffixes (#140)

  • from_str method of the JavaType has been replaced by the FromStr
    implementation

  • Implemented Sync for GlobalRef (#102).

  • Improvements in macro usage for JNI methods calls (#136):

    • call_static_method_unchecked and get_static_field_unchecked methods are
      allowed to return NULL object
    • Added checking for pending exception to the call_static_method_unchecked
      method (eliminated WARNING messages in log)
  • Further improvements in macro usage for JNI method calls (#150):

    • The new_global_ref() and new_local_ref() functions are allowed to work with NULL objects according to specification.
    • Fixed the family of functions new_direct_byte_buffer(), get_direct_buffer_address() and get_direct_buffer_capacity()
      by adding checking for null and error codes.
    • Increased tests coverage for JNIEnv functions.
  • Implemented Clone for JNIEnv (#147).

  • The get_superclass(), get_field_unchecked() and get_object_array_element() are allowed to return NULL object according
    to the specification (#163).

Fixed

  • The issue with early detaching of a thread by nested AttachGuard. (#139)

Don't miss a new jni release

NewReleases is sending notifications on new releases.