Skip to content

Bump jni from 0.21.1 to 0.22.2#678

Closed
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/cargo/jni-0.22.2
Closed

Bump jni from 0.21.1 to 0.22.2#678
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/cargo/jni-0.22.2

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Mar 2, 2026

Bumps jni from 0.21.1 to 0.22.2.

Release notes

Sourced from jni's releases.

Release JNI 0.22.2

Note: although no breaking API change was made in this release there were some important fixes made, including a few non-trivial changes to how exceptions are handled and some important safety / soundness fixes made in the re-exported jni-macros.

For these reasons I'm going to again yank the previous 0.22.1 release after this is published, again taking into account that 0.22.1 was itself only released very recently and it should still be relatively unlikely that anyone has strictly locked in a 0.22.1 dependency.

Another benefit to yanking 0.22.1 is that it allows me to pin the jni-macros dependency via =0.22.2 in this release so that in future releases I don't need to be worried that a new jni-macros release needs to be backwards compatible with all prior jni releases (so macros can take advantage of new jni features).

Hopefully things will be smoother moving forward, now that more people have been starting to update to 0.22.x and there are more people testing it.

Added

Adds bindings for the following java.lang errors / exceptions (#767):

  • JArrayIndexOutOfBoundsException (java.lang.ArrayIndexOutOfBoundsException)
  • JArrayStoreException (java.lang.ArrayStoreException)
  • JClassCircularityError (java.lang.ClassCircularityError)
  • JClassFormatError (java.lang.ClassFormatError)
  • JExceptionInInitializerError (java.lang.ExceptionInInitializerError)
  • JClassNotFoundException (java.lang.ClassNotFoundException)
  • JIllegalArgumentException (java.lang.IllegalArgumentException)
  • JIllegalMonitorStateException (java.lang.IllegalMonitorStateException)
  • JInstantiationException (java.lang.InstantiationException)
  • JLinkageError (java.lang.LinkageError)
  • JNoClassDefFoundError (java.lang.NoClassDefFoundError)
  • JNoSuchFieldError (java.lang.NoSuchFieldError)
  • JNoSuchMethodError (java.lang.NoSuchMethodError)
  • JNumberFormatException (java.lang.NumberFormatException)
  • JOutOfMemoryError (java.lang.OutOfMemoryError)
  • JRuntimeException (java.lang.RuntimeException)
  • JSecurityException (java.lang.SecurityException)
  • JStringIndexOutOfBoundsException (java.lang.StringIndexOutOfBoundsException)

Added AttachmentExceptionPolicy enum to control how Java exceptions are handled when attaching a thread (#768).

Changed

  • Replaced cesu8 crate with simd_cesu8 for MUTF-8 encoding, gaining SIMD acceleration and no_std compatibility
  • Removed dependency on paste crate (#752)
  • attach_current_thread* APIs immediately return Err(JavaException) if a Java exception is pending, so they don't have the side effect of clearing exceptions not thrown in the given closure (#756)
  • Removed proc-macro-crate dependency from the jni-macros crate (#758)
  • All internal use of JNI functions (not general calls into Java code) now catch exceptions and map to jni::errors::Error (#762)
  • JavaVM::attach_current_thread* APIs stash + re-throw pending exceptions so they can be run reliably, instead of bailing early with a JavaException error (e.g. needed in Drop implementations) (#768)

Fixed

  • Env::get_[static_]method/field_id APIs now correctly clear + map internal exceptions to Error::Method/FieldNotFound errors (#748)
  • Global/Weak::Drop no longer have the side effect of catching/clearing pending exceptions (#749)
  • Ensure that the Env::throw* APIs actually return Err(JavaException) as the docs state (#755)
  • JStackTraceElement binding fixed to lookup isNativeMethod instead of isNative (#760)
  • bind_java_type emits exception_checks before JNI calls to avoid undefined behaviour from calling non-exception-safe JNI functions with pending exceptions. (#757)
  • bind_java_type emits env.assert_top() checks to ensure that any new local reference has a lifetime that's associated with the top JNI stack frame (#776)

... (truncated)

Changelog

Sourced from jni's changelog.

[0.22.2] — 2026-03-01

Note: although no breaking API change was made in this release there were some important fixes made, including a few non-trivial changes to how exceptions are handled and some important safety / soundness fixes made in the re-exported jni-macros.

For these reasons I'm going to again yank the previous 0.22.1 release after this is published, again taking into account that 0.22.1 was itself only released very recently and it should still be relatively unlikely that anyone has strictly locked in a 0.22.1 dependency.

Another benefit to yanking 0.22.1 is that it allows me to pin the jni-macros dependency via =0.22.2 in this release so that in future releases I don't need to be worried that a new jni-macros release needs to be backwards compatible with all prior jni releases (so macros can take advantage of new jni features).

Hopefully things will be smoother moving forward, now that more people have been starting to update to 0.22.x and there are more people testing it.

Added

Adds bindings for the following java.lang errors / exceptions (#767):

  • JArrayIndexOutOfBoundsException (java.lang.ArrayIndexOutOfBoundsException)
  • JArrayStoreException (java.lang.ArrayStoreException)
  • JClassCircularityError (java.lang.ClassCircularityError)
  • JClassFormatError (java.lang.ClassFormatError)
  • JExceptionInInitializerError (java.lang.ExceptionInInitializerError)
  • JClassNotFoundException (java.lang.ClassNotFoundException)
  • JIllegalArgumentException (java.lang.IllegalArgumentException)
  • JIllegalMonitorStateException (java.lang.IllegalMonitorStateException)
  • JInstantiationException (java.lang.InstantiationException)
  • JLinkageError (java.lang.LinkageError)
  • JNoClassDefFoundError (java.lang.NoClassDefFoundError)
  • JNoSuchFieldError (java.lang.NoSuchFieldError)
  • JNoSuchMethodError (java.lang.NoSuchMethodError)
  • JNumberFormatException (java.lang.NumberFormatException)
  • JOutOfMemoryError (java.lang.OutOfMemoryError)
  • JRuntimeException (java.lang.RuntimeException)
  • JSecurityException (java.lang.SecurityException)
  • JStringIndexOutOfBoundsException (java.lang.StringIndexOutOfBoundsException)

Added AttachmentExceptionPolicy enum to control how Java exceptions are handled when attaching a thread (#768).

Changed

  • Replaced cesu8 crate with simd_cesu8 for MUTF-8 encoding, gaining SIMD acceleration and no_std compatibility
  • Removed dependency on paste crate (#752)
  • attach_current_thread* APIs immediately return Err(JavaException) if a Java exception is pending, so they don't have the side effect of clearing exceptions not thrown in the given closure (#756)
  • Removed proc-macro-crate dependency from the jni-macros crate (#758)
  • All internal use of JNI functions (not general calls into Java code) now catch exceptions and map to jni::errors::Error (#762)
  • JavaVM::attach_current_thread* APIs stash + re-throw pending exceptions so they can be run reliably, instead of bailing early with a JavaException error (e.g. needed in Drop implementations) (#768)

... (truncated)

Commits
  • 313847a Release jni 0.22.2
  • d86fc17 Release jni-macros 0.22.2
  • a55355a refactor(deps): replace cesu8 with simd_cesu8 for MUTF-8 encoding
  • 1ad5d43 bind_java_type: clamp API visibility to type visibility
  • 1cfb922 bind_java_type: add null reference checks
  • 26471d7 bind_java_type: fix (unsound) pointer cast in AsRef code
  • 0439d46 bind_java_type: emit env.assert_top() checks
  • e573c2c Add AttachConfig::exception_policy control + fix default
  • f490ddb Handle internal exceptions, minimizing exposure to Error::JavaExcetion
  • 16f57a7 Release javac 0.1.1
  • Additional commits viewable in compare view

Dependabot compatibility score

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)

@dependabot dependabot bot added dependencies Pull requests that update a dependency file rust Pull requests that update Rust code labels Mar 2, 2026
Bumps [jni](https://github.com/jni-rs/jni-rs) from 0.21.1 to 0.22.2.
- [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.2)

---
updated-dependencies:
- dependency-name: jni
  dependency-version: 0.22.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/cargo/jni-0.22.2 branch from 7b4ffbf to 3a6d4df Compare March 2, 2026 12:05
@torokati44
Copy link
Member

Let's wait with this for rust-mobile/android-activity#202 to be released.

@torokati44 torokati44 closed this Mar 2, 2026
@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Mar 2, 2026

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version. You can also ignore all major, minor, or patch releases for a dependency by adding an ignore condition with the desired update_types to your config file.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.

@dependabot dependabot bot deleted the dependabot/cargo/jni-0.22.2 branch March 2, 2026 12:06
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.

1 participant