IronCoreLabs / uniffi-bindgen-java

Mozilla Public License 2.0
5 stars 0 forks source link

Add support for Custom Types #12

Closed coltfred closed 4 months ago

coltfred commented 5 months ago

This adds support for custom types.

Because Java lacks support of type aliases, every type will be wrapped in a true new type. If this proves to be too painful support for direct primitives and builtins might be possible, but so much information about the newtype name would be lost.

We can try it this way for now and see if it's too painful.

github-actions[bot] commented 5 months ago

File Coverage Lines
All files 66% 66% :white_check_mark:
src/gen_java/mod.rs 72% 72% :white_check_mark:

Minimum allowed coverage is 0%

Generated by :monkey: cobertura-action against d949ae8043212a9c917d444e9ce8c13d19208d4c

skeet70 commented 4 months ago

To clarify for future us: we think we could make it work without newtypes by having the custom type get written out as it's builtin or specified concrete type, and having the codegen know to lift/lower through that using the custom code. It'd take some finessing with the custom type codetype on the Rust side though, and newtypes do a better job of preserving the intended functionality without that extra work. If it's too much hassle to need to marshall into and out of the newtypes, we'll take another look at it.