Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Custom Types #12

Merged
merged 7 commits into from
Jun 12, 2024
Merged

Add support for Custom Types #12

merged 7 commits into from
Jun 12, 2024

Conversation

coltfred
Copy link
Member

@coltfred coltfred commented Jun 4, 2024

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.

@coltfred coltfred requested a review from a team as a code owner June 4, 2024 03:16
@coltfred coltfred requested review from skeet70 and giarc3 and removed request for a team June 4, 2024 03:16
Copy link

github-actions bot commented Jun 4, 2024

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

Minimum allowed coverage is 0%

Generated by 🐒 cobertura-action against d949ae8

src/templates/CustomTypeTemplate.java Outdated Show resolved Hide resolved
src/templates/CustomTypeTemplate.java Outdated Show resolved Hide resolved
src/templates/CustomTypeTemplate.java Outdated Show resolved Hide resolved
src/templates/CustomTypeTemplate.java Outdated Show resolved Hide resolved
@skeet70
Copy link
Member

skeet70 commented Jun 12, 2024

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.

@skeet70 skeet70 merged commit dc8113f into main Jun 12, 2024
6 checks passed
@skeet70 skeet70 deleted the add-custom-types branch June 12, 2024 22:51
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