Skip to content

Cannot raise KeyError without arguments after 9.3.0.0 #6860

@GabrielNagy

Description

@GabrielNagy

Environment Information

> jruby -v
jruby 9.3.0.0 (2.6.8) 2021-09-17 85c20e780f OpenJDK 64-Bit Server VM 25.292-b10 on 1.8.0_292-b10 +jit [linux-x86_64]
> uname -a
Linux rocinante 5.10.61-1-MANJARO #1 SMP PREEMPT Thu Aug 26 20:36:54 UTC 2021 x86_64 GNU/Linux

Expected Behavior

JRuby should allow raising KeyError with no arguments, similar to MRI:

> ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
> ruby -e'raise KeyError'
Traceback (most recent call last):
-e:1:in `<main>': KeyError (KeyError)

Actual Behavior

Raising KeyError without arguments raises an ArgumentError:

> jruby -e'raise KeyError'
ArgumentError: wrong number of arguments calling `initialize` (given 0, expected 1..3)
        new at org/jruby/RubyClass.java:906
  exception at org/jruby/RubyException.java:129
     <main> at -e:1

Failure initially observed in https://github.com/puppetlabs/facter/pull/2438/checks?check_run_id=3719821972

This has worked previously with JRuby 9.2.19.0:

> jruby -v
jruby 9.2.19.0 (2.5.8) 2021-06-15 55810c552b OpenJDK 64-Bit Server VM 25.292-b10 on 1.8.0_292-b10 +jit [linux-x86_64]
> jruby -e'raise KeyError'
Exception `KeyError' at -e:1 - KeyError
KeyError: KeyError
  <main> at -e:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions