-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Because of some code that does not believe in duck typing, I need to subclass Time for testing purposes. This works fine in Ruby 2.4.2:
irb(main):001:0> class TT < Time ; def initialize(m, n) ; super(m) ; end ; end
=> :initialize
irb(main):002:0> TT.new(1, 2)
=> 0001-01-01 00:00:00 +0100
However, the same code fails in JRuby 9.1.13.0:
irb(main):004:0* class TT < Time ; def initialize(m, n) ; super(m) ; end ; end
=> :initialize
irb(main):005:0> TT.new(1, 2)
ArgumentError: wrong number of arguments (0 for 2)
from (irb):5:in `initialize'
from org/jruby/RubyTime.java:1252:in `new'
from (irb):5:in `<eval>'
from org/jruby/RubyKernel.java:994:in `eval'
from org/jruby/RubyKernel.java:1292:in `loop'
from org/jruby/RubyKernel.java:1114:in `catch'
from org/jruby/RubyKernel.java:1114:in `catch'
from .rbenv/versions/jruby-9.1.13.0/bin/irb:13:in `<main>'
Whereas providing an empty constructor works fine even in JRuby:
irb(main):001:0> class TT < Time ; def initialize ; super() ; end ; end
=> :initialize
irb(main):002:0> TT.new
=> 2018-03-30 01:07:33 +0200
Is this an obscure bug or have I misunderstood something?
Environment
jruby 9.1.13.0 (2.3.3) 2017-09-06 8e1c115 Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [darwin-x86_64]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels