-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
Environment
- ruby -v
jruby 9.1.8.0-SNAPSHOT (2.3.1) 2017-02-06 3f97c7a Java HotSpot(TM) 64-Bit Server VM 25.111-b14 on 1.8.0_111-b14 +indy +jit [linux-x86_64] - uname -a
Linux ok 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Test Case
o = BasicObject.new
begin
p IO.try_convert(o)
rescue
p $!
end
begin
p Rational(o)
rescue
p $!
end
Expected Behavior
- MRI returns
nilfor the try_convert case, and raises a TypeError forRational(). If conversion would be possible (to_ioorto_rexist), it would properly convert
nil
#<TypeError: can't convert BasicObject into Rational>
Actual Behavior
- JRuby always raises NoMethodErrors (no matter if
to_ioorto_rexist):
#<NoMethodError: undefined method `respond_to?' for #<BasicObject:0x6ec8211c>>
#<NoMethodError: undefined method `respond_to?' for #<BasicObject:0x6ec8211c>>
Reactions are currently unavailable