Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zocoi opened this issue May 6, 2016 · 3 comments
Closed

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

zocoi opened this issue May 6, 2016 · 3 comments

Comments

@zocoi
Copy link

@zocoi zocoi commented May 6, 2016

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 
@zocoi zocoi changed the title Strange behavior with Enumerable::max method [jRuby 9.1.0.0] Strange behavior with Enumerable::max method May 6, 2016
@zocoi
Copy link
Author

@zocoi zocoi commented May 6, 2016

FYI, I end up using max_by instead

@headius
Copy link
Member

@headius headius commented May 9, 2016

Grr. I ported over max and min from MRI but perhaps I messed something up. Will be fixed for 9.1.1.0

@headius headius added this to the JRuby 9.1.1.0 milestone May 9, 2016
@headius headius closed this in 06f63da May 9, 2016
headius added a commit that referenced this issue May 9, 2016
@zocoi
Copy link
Author

@zocoi zocoi commented May 9, 2016

thanks @headius

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.