Skip to content

Pass -1 for max arity when there's rest args - #9630

Merged
headius merged 1 commit into
jruby:masterfrom
headius:arity_rest_plus
Sep 2, 2026
Merged

headius merged 1 commit into
jruby:masterfrom
headius:arity_rest_plus

Conversation

@headius

@headius headius commented Sep 2, 2026 •

Copy link
Copy Markdown
Member

Arity errors use -1 to indicate "unlimited arguments" and format the arguments' upper bound as "1+". Core methods and one instance in popen logic instead used either Integer.MAX_VALUE or incorrectly just added required plus optional even when rest.

I discovered this while connecting Kernel.exec logic up to the CRuby popen logic in #9627. That change moved the implementation of Kernel.exec into core, where it was subject to the arity-checking in generated method stubs that incorrectly used "rest + optional" as the max, even when a rest argument was provided. This caused the new exec logic to fail an unrelated arity-error message test in test_message_change_issue_6085 in CRuby's test_arity.rb.

Arity errors use -1 to indicate "unlimited arguments" and format
the arguments' upper bound as "1+". Core methods and one instance
in popen logic instead used either Integer.MAX_VALUE or incorrectly
just added rest plus optional even when rest.
@headius headius added this to the JRuby 10.1.2.0 milestone Sep 2, 2026
@headius
headius merged commit eb88d1a into jruby:master Sep 2, 2026
133 of 134 checks passed
@headius
headius deleted the arity_rest_plus branch September 2, 2026 06:50
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.

1 participant