-
Notifications
You must be signed in to change notification settings - Fork 48
Generate JavaKitFunction module #119
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
Conversation
Looks fine, PR doesn't seem to include changes to samples or a test though. Would you be interested in helping out in the other direction as well? We need to support all these in jextract as well: #101 |
I haven't been able to get |
let predicate: JavaPredicate<JavaInteger> = self.lessThanTen()! | ||
let value = predicate.test(JavaInteger(3).as(JavaObject.self)) | ||
print("Running a JavaPredicate from swift 3 < 10 = \(value)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a particular compelling example, but illustrates the module working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine, just at least some soundness check that it works at all 👍
I'd put it into a test file in this project and we're good them IMHO.
Cool, thanks!
Yes, this is what I had in mind.
If we can update the generator, that would be ideal. Perhaps we could use the
JavaKitExample is a little bit of a mess right now, and might not stick around as we get more focused and interesting samples. The ideal place to add tests for this kind of thing is in the Java2SwiftTests unit test target, where we translate individual classes and can check for the right output. It's a whole lot faster to iterate there than through the JavaKitExample project.
If we can improve the translator to provide this improved type information automatically, that would be wonderful! Ideally, it would be a separate change to this pull request, because it's likely to have an effect on many other translations into Swift. |
Let's go ahead and merge as-is, and any of the suggestions we made above can be follow-ups. Thanks! |
Add JavaKitFunction module & Makefile action as first steps for #84
Callsite Example
Java
Swift
Updated JavaKitExample available in this commit 7baa992
Questions
callAsFunction
implementation, should we add those by hand or is it worth updating the generator / config?JavaKitCollection
andJavaKitFunction
so these get run through CI?@JavaMethod
macro to support handling the cast to JavaObject? That would let us move from: