Skip to content
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

Restore arity-checking with an opt-out flag #7860

Merged
merged 3 commits into from Jul 17, 2023

Conversation

headius
Copy link
Member

@headius headius commented Jul 17, 2023

Removing automatic arity-checking for Java-based Ruby methods broke some users' test suites that expected ArgumentError to be thrown; without a manual arity-check, the target methods now tried to access the incoming vararg array blindly and raised Java index errors. This was reported as #7851.

This fixes the issue by restoring arity-checking by default and providing an opt-out flag that we and users can use to indicate that the Java code will check arity manually.

Removing automatic arity-checking for Java-based Ruby methods
broke some users' test suites that expected ArgumentError to be
thrown; without a manual arity-check, the target methods now tried
to access the incoming vararg array blindly and raised Java index
errors. This was reported as jruby#7851.

This fixes the issue by restoring arity-checking by default and
providing an opt-out flag that we and users can use to indicate
that the Java code will check arity manually.
@headius headius added this to the JRuby 9.4.4.0 milestone Jul 17, 2023
These were all moved to manual arity-checking in jruby#7751,
but that led to breakage when third-party extensions had varargs
paths that did not check arity manually (see jruby#7851).
Instead we restore the default to auto arity-check with this flag
provided for opting out (jruby#7680).
@JasonLunn
Copy link
Contributor

Thanks, @headius

@headius headius marked this pull request as ready for review July 17, 2023 23:00
@headius
Copy link
Member Author

headius commented Jul 17, 2023

Added a test for basic checkArity behavior. This is ready to go.

@headius
Copy link
Member Author

headius commented Jul 17, 2023

@JasonLunn If you could verify this fixes your case, we'd appreciate it!

@headius headius merged commit 5b8948f into jruby:master Jul 17, 2023
49 checks passed
@headius headius deleted the optional_auto_arity_check branch July 17, 2023 23:44
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.

@JRubyMethod minimum argument not enforced in 9.4.3.0
2 participants