Skip to content

Update to jni 0.22 and jni-sys 0.4#202

Open
rib wants to merge 1 commit intomainfrom
rib/pr/jni-0.22
Open

Update to jni 0.22 and jni-sys 0.4#202
rib wants to merge 1 commit intomainfrom
rib/pr/jni-0.22

Conversation

@rib
Copy link
Member

@rib rib commented Aug 11, 2025

This adds a common init_android_main_thread() utility that's called by both backends in order to get the ClassLoader from the Activity and associate that with the thread via JThread::set_context_class_loader (which jni 0.22 can use automatically when loading classes).

This change notably starts to use the jni::bind_java_type! macro for the KeyCharacterMap and InputDevice Java SDK API bindings in src/input/sdk.rs which is a nice simplification.

@MarijnS95 MarijnS95 force-pushed the release-0.6 branch 2 times, most recently from bdbfc4c to 8ab73d0 Compare November 15, 2025 14:07
@rib rib force-pushed the rib/pr/jni-0.22 branch 2 times, most recently from 3525414 to a7a4f64 Compare January 9, 2026 16:03
@rib rib changed the base branch from release-0.6 to main January 9, 2026 16:05
@rib rib force-pushed the rib/pr/jni-0.22 branch 5 times, most recently from 14d41bd to aaf0e8b Compare January 11, 2026 21:07
This adds a common init_android_main_thread() utility that's called by
both backends in order to get the ClassLoader from the Activity and
associate that with the thread via `JThreadthread::set_context_class_loader`
(which jni 0.22 can use automatically when loading classes).

This change notably starts to use the `jni::bind_java_type!` macro for the
`KeyCharacterMap` and `InputDevice` Java SDK API bindings in
`src/input/sdk.rs` which is a nice simplification.
@rib rib marked this pull request as ready for review February 18, 2026 01:19
Comment on lines +31 to +32
jni = "0.22"
jni-sys = "0.4.1"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, is jni-sys needed here? It seems that all the imports for jni_sys:: were changed to jni::sys:: as it's re-exported

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think you're probably right and this explicit dep can be removed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments