Eric Barendt created JRUBY-6380: ----------------------------------- Summary: Original array is overwritten when select! is called on a copy Key: JRUBY-6380 URL: https://jira.codehaus.org/browse/JRUBY-6380 Project: JRuby Issue Type: Bug Components: Standard Library Affects Versions: JRuby 1.6.5 Environment: JRuby 1.6.5 on Linux and Windows with Java 7 Reporter: Eric Barendt Assignee: Thomas E Enebo
# 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 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa 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