probable bug in ObjectSpace::define_finalizer
---------------------------------------------
Key: JRUBY-1282
URL: http://jira.codehaus.org/browse/JRUBY-1282
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.0.0RC3
Environment: Windows XP
Reporter: Ronald Fischer
Priority: Critical
Attachments: finalizer_test.rb
The following program prints an error message:
class C
def initialize
ObjectSpace.define_finalizer(self,
self.class.method(:finalize).to_proc)
end
def disconnect
puts "C.disconnect"
end
def C.finalize(id)
puts "C.finalize "+id.class.to_s
id.disconnect
end
end
y=C.new
Running this program outputs:
C.finalize Fixnum
finalizer.rb:10:in `finalize': undefined method `disconnect' for
28:Fixnum (NoMe
thodError)
from finalizer.rb:17:in `to_proc'
from finalizer.rb:3
We can see that the id passed to finalize, is a number. It is supposed
to be, however,
the object itself which is going to be finalized.
This works well in Ruby, but not in JRuby.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.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