• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Changelog
2
3All notable changes to this project will be documented in this file.
4
5The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
8<!-- Use the following sections from the spec: http://keepachangelog.com/en/1.0.0/
9  - Added for new features.
10  - Changed for changes in existing functionality.
11  - Deprecated for soon-to-be removed features.
12  - Removed for now removed features.
13  - Fixed for any bug fixes.
14  - Security in case of vulnerabilities. -->
15
16## [Unreleased]
17
18## [0.19.0] — 2021-01-24
19
20### Added
21- `AutoArray` and generic `get_array_elements()`, along with `get_<type>_array_elements` helpers. (#287)
22- `size()` method to `AutoArray` and `AutoPrimitiveArray`. (#278 / #287)
23- `discard()` method to `AutoArray` and `AutoPrimitiveArray`. (#275 / #287)
24
25### Changed
26- Removed AutoPrimitiveArray::commit(). (#290)
27- `AutoByte/PrimitiveArray.commit()` now returns `Result`. (#275)
28- Removed methods get/release/commit_byte/primitive_array_{elements|critical}. (#281)
29- Renamed methods get_auto_byte/long/primitive_array_{elements|critical} to
30	get_byte/long/primitive_array_{elements|critical}. (#281)
31
32## [0.18.0] — 2020-09-23
33
34### Added
35- `JNIEnv#define_unnamed_class` function that allows loading a class without
36  specifying its name. The name is inferred from the class data. (#246)
37- `SetStatic<type>Field`. (#248)
38- `TryFrom<JValue>` for types inside JValue variants (#264).
39- Implemented Copy for JNIEnv (#255).
40- `repr(transparent)` attribute to JavaVM struct (#259)
41
42### Changed
43- Switch from `error-chain` to `thiserror`, making all errors `Send`. Also, support all JNI errors
44  in the `jni_error_code_to_result` function and add more information to the `InvalidArgList`
45  error. ([#242](https://github.com/jni-rs/jni-rs/pull/242))
46
47## [0.17.0] — 2020-06-30
48
49### Added
50- Get/ReleaseByteArrayElements, and Get/ReleasePrimitiveArrayCritical. (#237)
51
52## [0.16.0] — 2020-02-28
53
54### Fixed
55- Java VM instantiation with some MacOS configurations. (#220, #229, #230).
56
57## [0.15.0] — 2020-02-28
58
59### Added
60- Ability to pass object wrappers that are convertible to `JObject` as arguments to the majority
61 of JNIEnv methods without explicit conversion. (#213)
62- `JNIEnv#is_same_object` implementation. (#213)
63- `JNIEnv#register_native_methods`. (#214)
64- Conversion from `Into<JObject>` to `JValue::Object`.
65
66### Fixed
67- Passing `null` as class loader to `define_class` method now allowed according
68  to the JNI specification. (#225)
69
70## [0.14.0] — 2019-10-31
71
72### Changed
73- Relaxed some lifetime restrictions in JNIEnv to support the case when
74  method, field ids; and global references to classes
75  have a different (larger) lifetime than JNIEnv. (#209)
76
77## [0.13.1] — 2019-08-22
78
79### Changed
80- Various documentation improvements.
81
82## [0.13.0] — 2019-07-05
83
840.13 brings major improvements in thread management, allowing to attach the native threads
85permanently and safely; `Executor` for extra convenience and safety; and other
86improvements and fixes.
87
88:warning: If your code attaches native threads — make sure to check the updated documentation
89of [JavaVM](https://docs.rs/jni/0.13.0/jni/struct.JavaVM.html) to learn about the new features!
90
91### Added
92- `JavaVM::attach_current_thread_permanently` method, which attaches the current
93  thread and detaches it when the thread finishes. Daemon threads attached
94  with `JavaVM::attach_current_thread_as_daemon` also automatically detach themselves
95  when finished. The number of currently attached threads may be acquired using
96  `JavaVM::threads_attached` method. (#179, #180)
97- `Executor` — a simple thread attachment manager which helps to safely
98  execute a closure in attached thread context and to automatically free
99  created local references at closure exit. (#186)
100
101### Changed
102- The default JNI API version in `InitArgsBuilder` from V1 to V8. (#178)
103- Extended the lifetimes of `AutoLocal` to make it more flexible. (#190)
104- Default exception type from checked `java.lang.Exception` to unchecked `java.lang.RuntimeException`.
105  It is used implicitly when `JNIEnv#throw` is invoked with exception message:
106  `env.throw("Exception message")`; however, for efficiency reasons, it is recommended
107  to specify the exception type explicitly *and* use `throw_new`:
108  `env.throw_new(exception_type, "Exception message")`. (#194)
109
110### Fixed
111- Native threads attached with `JavaVM::attach_current_thread_as_daemon` now automatically detach
112  themselves on exit, preventing Java Thread leaks. (#179)
113- Local reference leaks in `JList`, `JMap` and `JMapIter`. (#190, #191)
114
115## [0.12.3]
116
117### Added
118- `From<jboolean>` implementation for `JValue` (#173)
119- `Debug` trait for InitArgsBuilder. (#175)
120- `InitArgsBuilder#options` returning the collected JVM options. (#177)
121
122## [0.12.2]
123
124### Changed
125- Updated documentation of GetXArrayRegion methods (#169)
126- Improved ABI compatibility on various platforms (#170)
127
128## [0.12.1]
129
130This release does not bring code changes.
131
132### Changed
133- Updated project documentation.
134
135## [0.12.0]
136
137### Changed
138- `JString`, `JMap` and `JavaStr` and their respective iterators now require an extra lifetime so
139  that they can now work with `&'b JNIEnv<'a>`, where `'a: 'b`.
140
141## [0.11.0]
142
143### Highlights
144This release brings various improvements and fixes, outlined below. The most notable changes are:
145- `null` is no longer represented as an `Err` with error kind `NullPtr` if it is a value of some
146  nullable Java reference (not an indication of an error). Related issues: #136, #148, #163.
147- `unsafe` methods, providing a low-level API similar to JNI, has been marked safe and renamed
148  to have `_unchecked` suffix. Such methods can be used to implement caching of class references
149  and method IDs to improve performance in loops and frequently called Java callbacks.
150  If you have such, check out [the docs][unchecked-docs] and [one of early usages][cache-exonum]
151  of this feature.
152
153[unchecked-docs]: https://docs.rs/jni/0.11.0/jni/struct.JNIEnv.html
154[cache-exonum]: https://github.com/exonum/exonum-java-binding/blob/affa85c026c1870b502725b291822c00f199745d/exonum-java-binding/core/rust/src/utils/jni_cache.rs#L40
155
156### Added
157- Invocation API support on Windows and AppVeyor CI (#149)
158
159### Changed
160- `push_local_frame`, `delete_global_ref` and `release_string_utf_chars`
161no longer check for exceptions as they are
162[safe](https://docs.oracle.com/javase/10/docs/specs/jni/design.html#exception-handling)
163to call if there is a pending exception (#124):
164  - `push_local_frame` will now work in case of pending exceptions — as
165  the spec requires; and fail in case of allocation errors
166  - `delete_global_ref` and `release_string_utf_chars` won't print incorrect
167  log messages
168
169- Rename some macros to better express their intent (see #123):
170  - Rename `jni_call` to `jni_non_null_call` as it checks the return value
171  to be non-null.
172  - Rename `jni_non_null_call` (which may return nulls) to `jni_non_void_call`.
173
174- A lot of public methods of `JNIEnv` have been marked as safe, all unsafe code
175  has been isolated inside internal macros. Methods with `_unsafe` suffixes have
176  been renamed and now have `_unchecked` suffixes (#140)
177
178- `from_str` method of the `JavaType` has been replaced by the `FromStr`
179  implementation
180
181- Implemented Sync for GlobalRef (#102).
182
183- Improvements in macro usage for JNI methods calls (#136):
184  - `call_static_method_unchecked` and `get_static_field_unchecked` methods are
185  allowed to return NULL object
186  - Added checking for pending exception to the `call_static_method_unchecked`
187  method (eliminated WARNING messages in log)
188
189- Further improvements in macro usage for JNI method calls (#150):
190  - The new_global_ref() and new_local_ref() functions are allowed to work with NULL objects according to specification.
191  - Fixed the family of functions new_direct_byte_buffer(), get_direct_buffer_address() and get_direct_buffer_capacity()
192   by adding checking for null and error codes.
193  - Increased tests coverage for JNIEnv functions.
194
195- Implemented Clone for JNIEnv (#147).
196
197- The get_superclass(), get_field_unchecked() and get_object_array_element() are allowed to return NULL object according
198 to the specification (#163).
199
200### Fixed
201- The issue with early detaching of a thread by nested AttachGuard. (#139)
202
203## [0.10.2]
204
205### Added
206- `JavaVM#get_java_vm_pointer` to retrieve a JavaVM pointer (#98)
207- This changelog and other project documents (#106)
208
209### Changed
210- The project is moved to an organization (#104)
211- Updated versions of dependencies (#105)
212- Improved project documents (#107)
213
214### Fixed
215- Crate type of a shared library with native methods
216  must be `cdylib` (#100)
217
218## [0.10.1]
219- No changes has been made to the Changelog until this release.
220
221[Unreleased]: https://github.com/jni-rs/jni-rs/compare/v0.19.0...HEAD
222[0.19.0]: https://github.com/jni-rs/jni-rs/compare/v0.18.0...v0.19.0
223[0.18.0]: https://github.com/jni-rs/jni-rs/compare/v0.17.0...v0.18.0
224[0.17.0]: https://github.com/jni-rs/jni-rs/compare/v0.16.0...v0.17.0
225[0.16.0]: https://github.com/jni-rs/jni-rs/compare/v0.15.0...v0.16.0
226[0.15.0]: https://github.com/jni-rs/jni-rs/compare/v0.14.0...v0.15.0
227[0.14.0]: https://github.com/jni-rs/jni-rs/compare/v0.13.1...v0.14.0
228[0.13.1]: https://github.com/jni-rs/jni-rs/compare/v0.13.0...v0.13.1
229[0.13.0]: https://github.com/jni-rs/jni-rs/compare/v0.12.3...v0.13.0
230[0.12.3]: https://github.com/jni-rs/jni-rs/compare/v0.12.2...v0.12.3
231[0.12.2]: https://github.com/jni-rs/jni-rs/compare/v0.12.1...v0.12.2
232[0.12.1]: https://github.com/jni-rs/jni-rs/compare/v0.12.0...v0.12.1
233[0.12.0]: https://github.com/jni-rs/jni-rs/compare/v0.11.0...v0.12.0
234[0.11.0]: https://github.com/jni-rs/jni-rs/compare/v0.10.2...v0.11.0
235[0.10.2]: https://github.com/jni-rs/jni-rs/compare/v0.10.1...v0.10.2
236[0.10.1]: https://github.com/jni-rs/jni-rs/compare/v0.1...v0.10.1
237