Skip to content

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

Merged
headius merged 3 commits intojruby:masterfrom
headius:optional_auto_arity_check
Jul 17, 2023
Merged

Restore arity-checking with an opt-out flag#7860
headius merged 3 commits intojruby:masterfrom
headius:optional_auto_arity_check

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).
@headius headius force-pushed the optional_auto_arity_check branch from 5ddad7a to 31b7c07 Compare July 17, 2023 21:57
@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
@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