Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.5
-
Fix Version/s: JRuby 1.6.6
-
Component/s: Standard Library
-
Labels:None
-
Environment:JRuby 1.6.5 on Linux and Windows with Java 7
-
Patch Submitted:Yes
-
Number of attachments :
Description
- Sample code that shows the problem (test.rb):
- Create an array
array = %w(value1 value2 a_value value2)
- Print the whole array
puts array.inspect
- Copy and modify an array
new_array = Array.new(array) new_array.select! { |element| element.start_with?("value") } puts new_array.inspect puts array.inspect - Output of the above code:
jruby --1.9 test.rb ["value1", "value2", "a_value", "value2"] ["value1", "value2", "value2"] ["value1", "value2", "value2", "value2"]
rvm use 1.9.3 ruby test.rb ["value1", "value2", "a_value", "value2"] ["value1", "value2", "value2"] ["value1", "value2", "a_value", "value2"]
A GitHub pull request to fix this issue:
https://github.com/jruby/jruby/pull/114
Sorry for the numbers. JIRA interpreted some of my # comments as the start of a list.