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

String does not use <=> to compare two string instances #2396

Closed
rjnienaber opened this Issue Dec 30, 2014 · 3 comments

Comments

Projects
None yet
4 participants
@rjnienaber

rjnienaber commented Dec 30, 2014

From: http://jira.codehaus.org/browse/JRUBY-3925. Differs from MRI on JRuby 1.7.18 and JRuby 9000.

There seems to be different behavior between JRuby 1.3.1 and MRI Ruby 1.8.7p72 when it comes to String comparison. MRI uses the <=> operator, whereas JRuby does not. This became an issue when I was trying to write a class that acted as an Enum type (for use with rails backed by postgres). The class was a subclass of String that overrode <=> to perform the comparison using an internal array containing the Enum values rather than the value of the Strings themselves. I was a bit surprised when my tests passed under ruby, but failed under jruby.

I've included a small test program and the output of both JRuby 1.3.1 and Ruby 1.8.7p72 (unfortunately, it isn't a junit test case, my apologies)

@donv

This comment has been minimized.

Member

donv commented Jan 3, 2015

Hi @rjnienaber !

Thanks for the report! JRuby 1.3.x is no longer supported. Could you try against JRuby 1.7.18?

Use the

--1.8

option to run in Ruby 1.8 mode.

@donv donv added the ruby 1.8 label Jan 3, 2015

@rjnienaber

This comment has been minimized.

rjnienaber commented Jan 3, 2015

Sorry that the ticket is unclear. This is an old ticket from the original JIRA issue tracker, JRUBY-3925. I tested it against JRuby 1.7.18 and JRuby 9000 and the behaviour is still the same as JRuby 1.3. The original ticket has 3 files with the output from the test.

@rtyler rtyler added the JRuby 1.7.x label Mar 23, 2015

jacknagel added a commit to Homebrew/install that referenced this issue Apr 17, 2015

@enebo enebo added this to the JRuby 9.2.0.0 milestone May 16, 2017

@enebo

This comment has been minimized.

Member

enebo commented May 16, 2017

This was actually fixed some time during the 9.1.x cycle. I am marking against 9.2 so people can see it resolved. 1.7 is EOL so we won't be fixing it there.

@enebo enebo closed this May 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment