Skip to content

[jRuby 9.1.0.0] Strange behavior with Enumerable::max method #3856

@zocoi

Description

@zocoi

Environment

jRuby 9.1.0.0

Expected Behavior

in 9.0.1.0

jruby-9.0.1.0 :002 > [1,2,3,4,5].max {|el| puts el.inspect; el}
2
3
4
5
 => 5 

Actual Behavior

jruby-9.1.0.0 :002 > [1,2,3,4,5].max {|el| puts el.inspect; el }
[2, 1]
NoMethodError: undefined method `>' for [2, 1]:Array
    from org/jruby/RubyArray.java:4211:in `max'
    from (irb):2:in `<eval>'
    from org/jruby/RubyKernel.java:983:in `eval'
    from org/jruby/RubyKernel.java:1290:in `loop'
    from org/jruby/RubyKernel.java:1103:in `catch'
    from org/jruby/RubyKernel.java:1103:in `catch'

In MRI 2.3.1

2.3.1 :001 > [1,2,3,4,5].max {|el| puts el.inspect; el }
2
3
4
5
 => 5 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions