Conversation
This version replaces the backport pure-Ruby version and passes all CRuby tests and ruby/spec specs for Data other than those relating to Marshal.
Data is a confusing type in CRuby, because although it does not extend from Struct, it looks like Struct internally for all other purposes. In JRuby, where we are implementing Data as a specialized RubyObject subclass, we have no way to identify the instances as either Data or Struct. This makes marshal's narrowing of Data to Struct a bit tricky to support. This issue also means we cannot currently support extending a Data class with another concrete Ruby class, because the field specialization must live on the nearest concrete type. The effect of this is that extended Data classes will fail to see their own members and raise an error on construction. Barring the issues with extended Data classes, all specs for Data marshaling are now green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous functionality was provided by the backported pure-Ruby version of Data, which had several issues:
withand deconstruction.The new implementation is based upon our existing object-shaping logic. Members declared to
defineare set up as Java fields and the resulting Data subtype will allocate a right-sized RubyObject to hold them. All accesses of the Data members should optimize to direct Java field accesses.