-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
protobuf support for jruby #146
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
CLAs look good, thanks! |
As per #121 , this is the jruby version. |
This is fantastic, thanks @isaiah! I'll take a closer look when I'm back in the office after the holidays and will probably have more detailed comments then. |
|
||
# enum value has to be defined in java |
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.
Hmm, has proto3 support for Java not yet been implemented/released? For proto3, the semantics of enums are supposed to be open, but of course if protobuf-Java hasn't been augmented to support this yet then this won't work yet.
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.
You are correct, it's supported. I'll update the code.
This looks great from a high level, thanks for making this happen! I'm glad you implemented the API set forth in Chris's MRI extension. A high-level comment (before Chris and others dive in a little deeper): is there a reason you changed the test so much? Ideally the JRuby extension would be implemented in such a way that the existing test passes verbatim. Adding test cases can be useful too, but the test file was changed so extensively that it's hard to tell whether you changed existing semantics or not. |
@haberman There were mainly two changes, firstly Secondly, the original assertions are not very friendly, they were replace by more specific assertions, compare the following failing message:
VS
|
Hey @isaiah, I've got 3 minor questions for you:
Thanks for the work! |
Hi @ratnikov, I am not sure if I understood the third question correctly, but I'll try:
|
@@ -0,0 +1,15 @@ | |||
syntax = "proto3"; |
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.
Can we move this file to the jruby directory, as it's jruby-extension-specific?
Overall looks good. Just spoke with @pherl (our team lead) on how to handle this PR. We think it's best to merge this to a branch ( |
Also, FYI, I just created the |
@cfallin In that case let's wait until maps and oneofs are implemented. I've finished the map support in a separate branch, and the oneofs should not be far away. |
Sounds good. Thanks for all the work on this! |
Hi @cfallin , maps and oneofs are implemented. |
throw context.runtime.newArgumentError("Type class has no descriptor. Please pass a " + | ||
"class or enum as returned by the DescriptorPool."); | ||
} | ||
// TODO validate descriptor type |
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.
Fix TODO?
This looks really good overall! Just the few comments above then I think we can merge. |
Hi @isaiah, I just left a few more comments -- after some internal discussions, we think it's best to exclude the JSON/formatting stuff for now. Also, could you rebase everything to a single commit off of our Assuming both of those changes are made, I'm happy to LGTM and merge. Thanks! |
a302036
to
2991898
Compare
@cfallin Specs are green on both platform now. |
It is safe in the jruby case, since the string is a copy. The implementation is quite different from the C counterpart, it delegates most of the operations to the underline |
Yikes! Sorry, with time away from this PR, the details had faded in my mind. But I realize now that there's a semantic difference, which could be a problem. Consider:
In general, calling I think the solution to this is to somehow hold mutable builders for all submessage fields, and Does that sound reasonable? |
Yes, I thought about it, it requires the extension to manage the data by itself and only use protobuf-java for serialize/deserialize. I will take a look and see how it goes. |
Thanks! Sorry for nitpicking so much. Just want to make sure to get it right :-) |
No worries, I totally agree with you, the difference is quite fatal. |
Hi @cfallin , fixed. |
I just left one comment on |
Looks good, merging now, thanks! |
Fixed amalgamation to not list header files explicitly.
JRuby support via native extension.
It's basically a wrapper around
DynamicMessage
The tests are changed to use minitest instead of test/unit.
There are a few differences/bugs than the c implementation:
DynamicMessage.Builder
DynamicMessage
cannot tell the difference between an empty message and the default instance.