Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.1.6, JRuby 1.2
-
Fix Version/s: JRuby 1.6
-
Component/s: Core Classes/Modules, Intro
-
Labels:None
-
Number of attachments :
Description
Given this code:
class MyArray < Array
attr_accessor :foo
def initialize
@foo = "bar"
end
end
my_a = MyArray.new
p my_a.uniq.foo
p my_a.flatten.foo
p my_a.foo
This is the output from Jruby 1.3.0RC2 (jruby 1.3.0RC2 (ruby 1.8.6p287) (2009-05-12 eb8fea4) (Java HotSpot(TM) Client VM 1.5.0_16) [i386-java])
nil
nil
"bar"
This is the output from (C) ruby 1.8.6:
"bar"
"bar"
"bar"
Granted this is an unusual case... but it is inconsistent and led to a hard-to-track-down bug.
Nice find (unfortunately
). Can I ask whether this use case came from some public library or other public code? We are interested in pointers to real-life cases of this that we can point to.