Skip to content

0.31.0 uniffi update#50

Merged
skeet70 merged 23 commits intomainfrom
0.31.0-uniffi-update
Mar 24, 2026
Merged

0.31.0 uniffi update#50
skeet70 merged 23 commits intomainfrom
0.31.0-uniffi-update

Conversation

@skeet70
Copy link
Copy Markdown
Member

@skeet70 skeet70 commented Mar 21, 2026

Because changing to JNA direct mapping required moving to primitives in some places, I also fixed #22 in this, which is a breaking change (it was already breaking due to required uniffi changes). I removed the dead literal code, as it was only for defaults in Kotlin, and trying to come up with something for defaults after the new uniffi versions added even more support for it clarified that we weren't going to add default support anytime soon.

Fixes #46, fixes #33, fixes #25, fixes #37

Unblocks IronCoreLabs/ironcore-alloy#288, will require a breaking change there.

  • switched to the new BindgenPaths API for generation internally
  • support methods on records and enums
  • multiple bugfixes ported from Kotlin changes
  • fully qualified all java.lang type use in templates to simplify imports and avoid potential name collisions
  • added omit_checksums config option, see the kotlin doc about it.
  • support the rename config option, see the docs.
  • Uniffi trait methods

Breaking

  • method checksums change (since we skipped over 0.30.0 this is only theoretically breaking)
  • --lib-file and --library CLI generator options removed, they're both now automatically detected by uniffi
  • Java callback interface implementations must now use primitive types (e.g., int, long, boolean) instead of boxed types (Integer, Long, Boolean) for non-optional primitive parameters and return types
  • use Java primitive types (int, long, boolean, etc.) instead of boxed types (Integer, Long, Boolean) for non-optional primitive parameters, return types, and record fields. Optional primitives and primitives in generic contexts (e.g., List<Integer>, CompletableFuture<Integer>) still use boxed types as required by Java.

skeet70 added 14 commits March 19, 2026 14:50
- bugfix to prevent a potential Arc double free in async code if both the called function and the error handle threw.
Need another thorough once over of the required changes.
- added external type support
- fixed external errors, got rid of workaround
- switched to JNA direct mapping
- added config option omit_checksums
- still no defaults even though others expanded default support
Needs some more work on proc macro cases and probably more test cases
This prevents bugs like the few we've had so far where a type wasn't imported
because it wasn't added to the specific template where something was used. It also
eliminates the possibility of collisions with enum variant classes names.
it may be a bit more robust with edge cases like external types
@skeet70 skeet70 requested a review from a team as a code owner March 21, 2026 04:08
@skeet70 skeet70 requested review from coltfred and removed request for a team March 21, 2026 04:08
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 21, 2026

File Coverage Lines
All files 90% 90%
src/gen_java/mod.rs 92% 92%
src/lib.rs 61% 61%

Minimum allowed coverage is 0%

Generated by 🐒 cobertura-action against 7889de9

Copy link
Copy Markdown
Member

@coltfred coltfred left a comment

Choose a reason for hiding this comment

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

Couple variables that should be renamed back to their non _ names. Otherwise nothing stuck out to me.

}
} catch (Exception e) {
future.completeExceptionally(e);
} catch (java.lang.Exception _e) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You're using this, so it seems like e would be a fine name?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was from a bug on the Kotlin side where templated code contained user defined variable names, so the names could conflict. I went through again though and tried to make sure everywhere it was being done it actually could be with user params (I think), made those more explicit _uniffi_ex and reset the rest of things this had been done to.

skeet70 and others added 3 commits March 23, 2026 16:46
* Use primitive arrays for better ergonomics/performance

where possible. Special cases for primitives in the same vein as byte arrays,
any compound types will still be List-based

* Sort cargo
@skeet70 skeet70 merged commit 8a8ad71 into main Mar 24, 2026
7 checks passed
@skeet70 skeet70 deleted the 0.31.0-uniffi-update branch March 24, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants