Issue Type: Bug Bug
Affects Versions: JRuby 1.7.4
Assignee: Unassigned
Attachments: c_jruby.rb, in
Components: Core Classes/Modules
Created: 12/May/13 7:16 PM
Description:

I get an unexpected error when running the attached script and passing it the file 'in' via `jruby c_jruby.rb < in` (expected output is "Case #1: 5\nCase #2: 6\n"):

c_jruby.rb:52:in `rise!': bad value for range (ArgumentError)
from c_jruby.rb:44:in `each_subrange'
from c_jruby.rb:50:in `rise!'
from c_jruby.rb:67:in `attacked!'
from c_jruby.rb:44:in `each_subrange'
from c_jruby.rb:64:in `attacked!'
from c_jruby.rb:143:in `(root)'
from org/jruby/RubyFixnum.java:285:in `times'
from c_jruby.rb:114:in `(root)'

Adding p() around "from...to" at line 52 actually prevents the error. And it seems pretty clear only integers are forming the Range, so this error should not be raised.
I could reproduce with a freshly compiled version on OS X as well as an old 1.7.0.preview2.dev on Linux.

I met a few ConcurrentModificationError before due to updating while iterating, but it should be fine now and I did not meet any since I added the "updates" Array line 49.

For info:
I was doing the Round 1C of Google CodeJam today, and searched for some kind of "interval map" and it turns out Java has a nice TreeMap which can be the base of that. The code tries to solve the third problem "The Great Wall"
https://code.google.com/codejam/contest/2437488/dashboard#s=p2

Environment: jruby 1.7.4.dev (1.9.3p392) 2013-05-13 2e61708 on Java HotSpot(TM) 64-Bit Server VM 1.6.0_43-b01-447-10M4203 [darwin-x86_64]
jruby 1.7.0.preview2.dev (ruby-1.9.3-p203) (2012-07-17 412049f) (OpenJDK 64-Bit Server VM 1.6.0_22) [linux-amd64-java]
Project: JRuby
Priority: Major Major
Reporter: Benoit Daloze
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to