Skip to content

build(deps): update jni requirement from 0.21.1 to 0.22.0 in /rslib-bridge#644

Open
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/cargo/rslib-bridge/jni-0.22.0
Open

build(deps): update jni requirement from 0.21.1 to 0.22.0 in /rslib-bridge#644
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/cargo/rslib-bridge/jni-0.22.0

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Feb 17, 2026

Updates the requirements on jni to permit the latest version.

Release notes

Sourced from jni's releases.

Release JNI 0.22.0

The 0.22 release significantly improves safety and ergonomics through changes to thread attachment, environment handling, and the addition of compile-time macros for JNI strings, signatures as well as full Java type bindings.

Please see the jni 0.22 Migration Guide for guidance on how to update from jni 0.21

Added

JavaVM / Thread Attachment APIs

  • JavaVM::singleton() lets you acquire the JavaVM for the process when you know that the JavaVM singleton has been initialized (#595)
  • JavaVM::is_thread_attached can query whether the current thread is attached to the Java VM (#570)
  • AttachGuard::from_unowned added as a low-level (unsafe) way to represent a thread attachment with a raw jni_sys::Env pointer (#570)
  • AttachConfig exposes fine-grained control over thread attachment including Thread name, ThreadGroup and whether scoped or permanent. (#606)
  • JavaVM::attach_current_thread_guard is a low-level (unsafe) building block for attaching threads that exposes the AttachGuard and AttachConfig control. (#606)
  • JavaVM::attach_current_thread_with_config is a safe building block for attaching threads that hides the AttachGuard but exposes AttachConfig control. (#606)
  • JavaVM::with_local_frame added as method to borrow a Env that is already attached to the current thread, after pushing a new JNI stack frame (#570, #673)
  • JavaVM::with_top_local_frame_frame added to borrow a Env for the top JNI stack frame (i.e. without pushing a new JNI stack frame) (#570, #673)

Reference Type APIs

  • A Reference trait for all reference types like JObject, JClass, JString, enabling Global and Weak to be generic over Reference and enabling safe casting and global caching of JClass references. (#596)
  • Reference::lookup_class exposes a cached Global<JClass> for all Reference implementations (#612)
  • LoaderContext + LoaderContext::load_class for loading classes, depending on available context (#612)
  • Env::new_cast_global_ref acts like new_global_ref with a type cast (#612)
  • Env::cast_global takes an owned Global<From> and returns an owned Global<To> (#612)
  • Env::new_cast_local_ref acts like new_local_ref with a type cast (#612)
  • Env::cast_local takes an owned local reference and returns a new type-cast wrapper (owned) (#612)
  • Env::as_cast or Cast::new borrows any From: Reference (global or local) reference and returns a Cast<To> that will Deref into &To (#612)
  • Env::as_cast_unchecked returns a Cast<To> like as_cast() but without a runtime IsInstanceOf check (#669)
  • Env::as_cast_raw or Cast::from_raw borrows a raw jobject reference and returns a Cast<To> that will Deref into &To
  • Cast::new_unchecked and Cast::from_raw_unchecked let you borrow a reference with an (unsafe) type cast, with no runtime check
  • ::cast_local() methods as a convenience for all reference types, such as let s = JString::cast_local(obj)
  • const null() methods for all reference types.
  • Global::null() and Weak::null() construct null references (equivalent to Default::default()). (#596)

JNI Environment APIs

  • Env::call_nonvirtual_method and Env::call_nonvirtual_method_unchecked to call non-virtual method. (#454)
  • Env::to_reflected_method and Env::to_reflected_static_method for retrieving the Java reflection API instance for a method or constructor. (#579)
  • Env::throw_new_void provides an easy way to throw an exception that's constructed with no message argument
  • Env::new_object_type_array<E> lets you you instantiate a JObjectArray with a given element type like new_object_type_array::<JString>
  • Env::load_class supports class lookups via the current Thread context class loader, with FindClass fallback. (#674)
  • MethodSignature and FieldSignature types have been added for compile-time parsed JNI method and field signatures

Native Method APIs

  • EnvUnowned is an FFI-safe type that can be used to capture a jni_sys::Env pointer given to native methods and give it a named lifetime (this can then be temporarily upgraded to a &mut Env reference via EnvUnowned::with_env) (#570)
  • Outcome is like a Result with the addition of a third Panic() variant, used for careful handling of errors in native methods. (#664)
  • EnvOutcome represents an EnvUnowned::with_env outcome whose errors can be handle, with access to JNI, via an ErrorPolicy. (#664)
  • ErrorPolicy is a trait with on_error and on_panic methods that can log native method errors or throw them as exceptions. (#664)

... (truncated)

Changelog

Sourced from jni's changelog.

[0.22.0] — 2026-02-17

Added

JavaVM / Thread Attachment APIs

  • JavaVM::singleton() lets you acquire the JavaVM for the process when you know that the JavaVM singleton has been initialized (#595)
  • JavaVM::is_thread_attached can query whether the current thread is attached to the Java VM (#570)
  • AttachGuard::from_unowned added as a low-level (unsafe) way to represent a thread attachment with a raw jni_sys::Env pointer (#570)
  • AttachConfig exposes fine-grained control over thread attachment including Thread name, ThreadGroup and whether scoped or permanent. (#606)
  • JavaVM::attach_current_thread_guard is a low-level (unsafe) building block for attaching threads that exposes the AttachGuard and AttachConfig control. (#606)
  • JavaVM::attach_current_thread_with_config is a safe building block for attaching threads that hides the AttachGuard but exposes AttachConfig control. (#606)
  • JavaVM::with_local_frame added as method to borrow a Env that is already attached to the current thread, after pushing a new JNI stack frame (#570, #673)
  • JavaVM::with_top_local_frame_frame added to borrow a Env for the top JNI stack frame (i.e. without pushing a new JNI stack frame) (#570, #673)

Reference Type APIs

  • A Reference trait for all reference types like JObject, JClass, JString, enabling Global and Weak to be generic over Reference and enabling safe casting and global caching of JClass references. (#596)
  • Reference::lookup_class exposes a cached Global<JClass> for all Reference implementations (#612)
  • LoaderContext + LoaderContext::load_class for loading classes, depending on available context (#612)
  • Env::new_cast_global_ref acts like new_global_ref with a type cast (#612)
  • Env::cast_global takes an owned Global<From> and returns an owned Global<To> (#612)
  • Env::new_cast_local_ref acts like new_local_ref with a type cast (#612)
  • Env::cast_local takes an owned local reference and returns a new type-cast wrapper (owned) (#612)
  • Env::as_cast or Cast::new borrows any From: Reference (global or local) reference and returns a Cast<To> that will Deref into &To (#612)
  • Env::as_cast_unchecked returns a Cast<To> like as_cast() but without a runtime IsInstanceOf check (#669)
  • Env::as_cast_raw or Cast::from_raw borrows a raw jobject reference and returns a Cast<To> that will Deref into &To
  • Cast::new_unchecked and Cast::from_raw_unchecked let you borrow a reference with an (unsafe) type cast, with no runtime check
  • ::cast_local() methods as a convenience for all reference types, such as let s = JString::cast_local(obj)
  • const null() methods for all reference types.
  • Global::null() and Weak::null() construct null references (equivalent to Default::default()). (#596)

JNI Environment APIs

  • Env::call_nonvirtual_method and Env::call_nonvirtual_method_unchecked to call non-virtual method. (#454)
  • Env::to_reflected_method and Env::to_reflected_static_method for retrieving the Java reflection API instance for a method or constructor. (#579)
  • Env::throw_new_void provides an easy way to throw an exception that's constructed with no message argument
  • Env::new_object_type_array<E> lets you you instantiate a JObjectArray with a given element type like new_object_type_array::<JString>
  • Env::load_class supports class lookups via the current Thread context class loader, with FindClass fallback. (#674)
  • MethodSignature and FieldSignature types have been added for compile-time parsed JNI method and field signatures

Native Method APIs

  • EnvUnowned is an FFI-safe type that can be used to capture a jni_sys::Env pointer given to native methods and give it a named lifetime (this can then be temporarily upgraded to a &mut Env reference via EnvUnowned::with_env) (#570)
  • Outcome is like a Result with the addition of a third Panic() variant, used for careful handling of errors in native methods. (#664)
  • EnvOutcome represents an EnvUnowned::with_env outcome whose errors can be handle, with access to JNI, via an ErrorPolicy. (#664)
  • ErrorPolicy is a trait with on_error and on_panic methods that can log native method errors or throw them as exceptions. (#664)
  • ThrowRuntimeExAndDefault is an ErrorPolicy that throws any error as a RuntimeException (and returns a default value). (#664)
  • LogErrorAndDefault is an ErrorPolicy that logs errors and returns a default value. (#664)
  • LogContextErrorAndDefault is an ErrorPolicy that logs errors, with a given context string, and returns a default value. (#664)

... (truncated)

Commits
  • 779a9b4 Release jni 0.22
  • 7801d19 Inline assert_top checks
  • 023aa58 cargo publish --dry-run fixes
  • 71875ba env: fix load_class example
  • 7c5414d Update jni lib.rs example docs
  • d04db59 Move crates/jni/example -> crates/jni/mylib-example
  • 6da05fb Build 0.22-MIGRATION.md examples as doc tests
  • 2f4d349 Link to JNI spec in native_method macro docs
  • 362f7d2 tweak jni_sig docs
  • 4293ff6 Add Env::call_method example to rustdocs
  • Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Updates the requirements on [jni](https://github.com/jni-rs/jni-rs) to permit the latest version.
- [Release notes](https://github.com/jni-rs/jni-rs/releases)
- [Changelog](https://github.com/jni-rs/jni-rs/blob/master/CHANGELOG.md)
- [Commits](jni-rs/jni-rs@v0.21.1...v0.22.0)

---
updated-dependencies:
- dependency-name: jni
  dependency-version: 0.22.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file rust Pull requests that update Rust code labels Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants

Comments