Highlights
This release brings various improvements and fixes, outlined below. The most notable changes are:
- ⚠️
null
is no longer represented as anErr
with error kindNullPtr
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
andrelease_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 errorsdelete_global_ref
andrelease_string_utf_chars
won't print incorrect
log messages
-
Rename some macros to better express their intent (see #123):
- Rename
jni_call
tojni_non_null_call
as it checks the return value
to be non-null. - Rename
jni_non_null_call
(which may return nulls) tojni_non_void_call
.
- Rename
-
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 theJavaType
has been replaced by theFromStr
implementation -
Implemented Sync for GlobalRef (#102).
-
Improvements in macro usage for JNI methods calls (#136):
call_static_method_unchecked
andget_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)