Skip to content

JRuby 10: incorrect Method#arity with keyword arguments #8698

@tikkss

Description

@tikkss

It seems that Method#arity does not handle keyword arguments correctly in JRuby 10.0.0.0-SNAPSHOT.

Environment Information

Provide at least:

  • JRuby version: jruby 10.0.0.0-SNAPSHOT (3.4.2) 2025-03-15 a4e4d7d OpenJDK 64-Bit Server VM 21+35-2513 on 21+35-2513 +indy +jit [x86_64-linux]
  • Operating system and platform: Linux e19b5868bce9 6.10.14-linuxkit break script engine #1 SMP PREEMPT_DYNAMIC Mon Feb 24 16:37:44 UTC 2025 x86_64 GNU/Linux

Steps to reproduce

Run the following command:

$ jruby -v -e '
class C
  def x(a, b: nil, &c)
  end
end
c = C.new
p c.method(:x).arity
'

Expected Behavior

jruby 10.0.0.0-SNAPSHOT (3.4.2) 2025-03-15 a4e4d7dc4c OpenJDK 64-Bit Server VM 21+35-2513 on 21+35-2513 +indy +jit [x86_64-linux]
-2

Actual Behavior

jruby 10.0.0.0-SNAPSHOT (3.4.2) 2025-03-15 a4e4d7dc4c OpenJDK 64-Bit Server VM 21+35-2513 on 21+35-2513 +indy +jit [x86_64-linux]
1

JRuby 9.4 returns the expected result:

jruby 9.4.12.0 (3.1.4) 2025-02-11 f4ab75096a OpenJDK 64-Bit Server VM 25.442-b06 on 1.8.0_442-b06 +jit [x86_64-linux]
-2

CRuby 3.4 also returns the expected result:

ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [x86_64-darwin24]
-2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions