Range#size is supposed to be working in JRuby 1.7.10 --2.0 mode, but it still fails

StackOverflow https://stackoverflow.com/questions/21394932

  •  03-10-2022
  •  | 
  •  

Question

Per http://jruby.org/2014/01/09/jruby-1-7-10.html, the subject problem is supposed to be fixed in 1.7.10 via https://github.com/jruby/jruby/pull/1252. However, my experience is otherwise, per:

MacbookAir1:javlats palfvin$ jruby -v
jruby 1.7.10 (2.0.0p195) 2014-01-09 c4ecd6b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_65-b14-462-11M4609 [darwin-x86_64]
MacbookAir1:javlats palfvin$ jruby
(1..2).size
NoMethodError: undefined method `size' for 1..2:Range
  (root) at -:1
MacbookAir1:javlats palfvin$

I haven't figured out how to look at the Java code in an installed JRuby version, so I wasn't able to compare the installed Java source code to the version on github, but this seems so basic it's hard to believe there's anything in my environment that is messing it up. I Googled to see if anyone else had encountered this, but didn't find anything.

Any ideas?

Was it helpful?

Solution

If my git-fu is right, I don't think this commit was included in 1.7.10. Indeed, it looks to only be in master:

$ git show -s --oneline 01be8f85522e4da8df3968e622fa2c947ea6712c
01be8f8 Add a size method to RubyRange to resolve #1252

$ git branch -r --contains 01be8f85522e4da8df3968e622fa2c947ea6712c
  upstream/master
  upstream/unbox_opts

$ git tag  --contains 01be8f85522e4da8df3968e622fa2c947ea6712c

Perhaps there was a confusing merge somewhere in JRuby land?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top