Skip to content

Conversation

@trinistr
Copy link

@trinistr trinistr commented Nov 22, 2025

This uses a trivial implementation that satisfies MRI's interface. Spec is here: ruby/spec#1306

This PR is to familiarize myself with JRuby, so please, do not hesitate to point out how to do things correctly! A couple things I'm not sure about:

  • Is "java" string created correctly, considering non-default Encoding? This probably isn't actually needed, a default encoding should be fine, I only uses newUSASCIIString for full compatiblity. I've decided to just use the default, there is probably no reason to complicate this.
  • Is there a way to create an ArgumentError without specifying a message?

I haven't actually tested this code, and there don't seem to be any tests for GC, so there may need to be further actions on my part.

On a separate note, I believe that all "module = true" annotation options on GC are actually supposed to be "meta", as GC does not use module_function. And what does visibility = PRIVATE do here?

This uses a trivial implementation that satisfies MRI's interface.
if (arg.hasKey(RubySymbol.newSymbol(context.runtime, "implementation"))) {
throw context.runtime.newArgumentError("Attempting to set read-only key \"Implementation\"");
}
return config(context, recv);
Copy link
Author

@trinistr trinistr Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On 3.4 this would return an empty hash due to a bug, but on 4.0 this will contain :implementation. It's probably better to use the correct behavior, as it's mostly compatible. Spec is fixed here.

@headius
Copy link
Member

headius commented Nov 26, 2025

Very cool! I will review as soon as I can given the US holiday. Thank you for your efforts!

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