Skip to content

Additional improvements to new marshal logic#8685

Merged
headius merged 6 commits intojruby:masterfrom
headius:more_new_marshal
Mar 11, 2025
Merged

Additional improvements to new marshal logic#8685
headius merged 6 commits intojruby:masterfrom
headius:more_new_marshal

Conversation

@headius
Copy link
Member

@headius headius commented Mar 10, 2025

This PR is intended to address the concerns mentioned in #8683.

Fixes #8683.

Goals:

This addresses some of the concerns mentioned in jruby#8683.

* ThreadContext propagated everywhere it might end up being needed
* Consistent ordering of new context and out arguments
* No longer save the context in RubyOutputStream; use a new
  set of write methods.
@headius headius added this to the JRuby 10.0.0.0 milestone Mar 10, 2025
@headius
Copy link
Member Author

headius commented Mar 10, 2025

@enebo I have implemented the context-propagation part of this, which did find a few places that were forced to re-acquire the context.

However I now feel it is excessive to have a special RubyOutputStream that can propagate the context solely for the purpose of raising an error. I'd like your thoughts on how to reduce or eliminate RubyOutputStream, since all it does is raise Ruby errors and drop throws IOException from the standard OutputStream write methods.

@enebo
Copy link
Member

enebo commented Mar 11, 2025

@headius yeah let's chat about this when we are both around.

headius added 2 commits March 11, 2025 12:08
Unfortunately deprecating code does not avoid removal warnings, so
we also have to SuppressWarnings("removal") anywhere we reference
MarshalStream, and cannot directly import the class.
* NewMarshal => Dumper
* NewMarshalCache inlined (no need for separate object)
* RubyOutputStream drops context signatures and moves to
  org.jruby.util.io (general OutputStream wrapper utility)
@headius
Copy link
Member Author

headius commented Mar 11, 2025

Interface mitigation has been made moot by our intent to fully commit to the new API. As described in #8683 (comment) I could find no examples of ObjectMarshal being implemented outside of JRuby, so we just deprecate the old methods and classes for removal and will aid users in supporting the new API.

headius added 3 commits March 11, 2025 13:28
These writes don't need context now that RubyOutputStream does not
receive context.
* Use switch expression for simple switch that assigns a var.
* Remove cast to unchecked RubyArray.
@headius headius marked this pull request as ready for review March 11, 2025 18:30
@headius headius merged commit f8d9725 into jruby:master Mar 11, 2025
0 of 27 checks passed
@headius headius deleted the more_new_marshal branch March 11, 2025 18:30
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.

New marshal could break ext authors using old one

2 participants