Calling new on singleton should fail
------------------------------------
Key: JRUBY-1389
URL: http://jira.codehaus.org/browse/JRUBY-1389
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.0.1
Environment: OS X, jruby 1.1 rev 3876, Java 1.5
Reporter: Daniel Berger
Priority: Minor
Fix For: JRuby 1.1.0
In MRI, calling new on the singleton of a class raises a TypeError:
irb(main):001:0> class Foo; end
=> nil
irb(main):002:0> foo = Foo.new
=> #<Foo:0x10c70b4>
irb(main):003:0> sfoo = class << foo; self; end
=> #<Class:#<Foo:0x10c70b4>>
irb(main):004:0> sfoo.new
TypeError: can't create instance of virtual class
from (irb):6:in `new'
from (irb):6
In JRuby, it appears to create a new instance.
--
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