Skip to content

define_method with empty body throws RuntimeError in interpreter #3483

@annawinkler

Description

@annawinkler

If you do the following in jruby 9.0.4.0:

> define_method(:foo) { |*| }
> foo("hi")

You get this RuntimeError:

RuntimeError: BUG: interpreter fell through to end unexpectedly
    from (irb):2:in `foo'
    from (irb):2:in `<eval>'
    from org/jruby/RubyKernel.java:978:in `eval'
    from org/jruby/RubyKernel.java:1291:in `loop'
    from org/jruby/RubyKernel.java:1098:in `catch'
    from org/jruby/RubyKernel.java:1098:in `catch'
    from /home/vagrant/.rbenv/versions/jruby-9.0.4.0/bin/irb:13:in `<top>'

I tried the same in jruby-9.0.1.0, and it works as follows:

irb(main):005:0> define_method(:foo) { |*| }
=> :foo
irb(main):006:0> foo("hi")
=> nil

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions