Skip to content

Upgrade jni to 0.22#193

Draft
djc wants to merge 2 commits intomainfrom
jni-0.22
Draft

Upgrade jni to 0.22#193
djc wants to merge 2 commits intomainfrom
jni-0.22

Conversation

@djc
Copy link
Member

@djc djc commented Sep 13, 2025

To give feedback upstream.

@djc djc requested review from complexspaces, cpu and ctz September 13, 2025 19:27
@complexspaces
Copy link
Collaborator

It looks like we'll need to finally bump our MSRV with this update, as jni now has an MSRV of 1.77. This is 8 months newer, but hopefully by this point most users have moved on? Debian stable is on 1.85 so I think we're OK personally.
image

@complexspaces complexspaces force-pushed the jni-0.22 branch 2 times, most recently from 38af1e3 to c85fd1c Compare September 13, 2025 23:03
@complexspaces
Copy link
Collaborator

I've pushed up an initial attempt to adopt the new API of jni 0.22. It looks like there's some problems and lints that still need to be fixed but I'm out of steam for further fiddling today.

@atouchet
Copy link

jni 0.22 is out now.

@djc
Copy link
Member Author

djc commented Feb 23, 2026

@djc
Copy link
Member Author

djc commented Feb 23, 2026

error:
       … while checking the derivation 'packages.x86_64-linux.rustls-platform-verifier'

       … while calling the 'derivationStrict' builtin
         at «nix-internal»/derivation-internal.nix:38:12:
           37|
           38|   strict = drvFunc drvAttrs;
             |            ^
           39|

       … while evaluating derivation 'rustls-platform-verifier'
         whose name attribute is located at «github:NixOS/nixpkgs/8c50662»/pkgs/stdenv/generic/make-derivation.nix:333:7

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: No hash was found while vendoring the git dependency jni-0.22.0. You can add
       a hash through the `outputHashes` argument of `importCargoLock`:

       outputHashes = {
         "jni-0.22.0" = "<hash>";
       };

       If you use `buildRustPackage`, you can add this attribute to the `cargoLock`
       attribute set.

Not sure what this means, nor am I really motivated to learn...

@cpu
Copy link
Member

cpu commented Feb 23, 2026

Not sure what this means, nor am I really motivated to learn...

The error message suggests how to fix the problem (add an explicit outputHashes for the patched crate), but it will also go away when you stop using a cargo patch to take a git dependency on jni. I would recommend ignoring it for now.

@djc
Copy link
Member Author

djc commented Feb 24, 2026

Not sure what this means, nor am I really motivated to learn...

The error message suggests how to fix the problem (add an explicit outputHashes for the patched crate), but it will also go away when you stop using a cargo patch to take a git dependency on jni. I would recommend ignoring it for now.

Dropped the patch section, which is no longer necessary anyway.

@djc
Copy link
Member Author

djc commented Feb 24, 2026

Okay, so the test suite doesn't compile yet, and I don't think I have enough context on how this should work to fix that.

Also, the Nix stuff fails, probably because the compiler is too old and the flake.lock rust-overlay needs an update?

@djc
Copy link
Member Author

djc commented Mar 4, 2026

Upgraded the PR to 0.22.2. Still needs someone with more JVM and/or Nix context to move forward.

@neunenak
Copy link

I'm working on a project involving using reqwests version 0.13 on Android, and this version bump would be very helpful for integrating it into the Rust-Kotlin FFI pipeline I already have which is on jni 0.22. I'm hoping to see this get merged and released quickly.

@neunenak
Copy link

Okay, so the test suite doesn't compile yet, and I don't think I have enough context on how this should work to fix that.

Also, the Nix stuff fails, probably because the compiler is too old and the flake.lock rust-overlay needs an update?

Looking at the error messages in CI, it seems like there are some complaints about edition2024 not being supported by the current rust compiler version, which the flake is getting from the Cargo.toml file, which was set to 1.77 in this commit. 1.85 is the earliest version that supports edition 2024, so the version bump might need to go there to make this work.

@cpu
Copy link
Member

cpu commented Mar 11, 2026

Also, the Nix stuff fails, probably because the compiler is too old and the flake.lock rust-overlay needs an update?

Indeed, here's a fix commit that fixes the Nix CI jobs on this branch. Do you want to cherry-pick it in here, or should I open a separate PR?

(Meta note: I added that flake+CI integration and would be OK with it being removed if i'm the only thing keeping it from annoying other contributors. Fighting Android+native platform APIs doesn't spark joy and unless there's a sponsorship motivation I'd prefer to prioritize volunteering time in other Rustls repos)

@neunenak
Copy link

I just tried making #224 to see if that version bump might fix the CI problems, but it seems the CI pipeline won't run for me.

@neunenak neunenak mentioned this pull request Mar 11, 2026
@cpu cpu mentioned this pull request Mar 12, 2026
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.

5 participants