jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [linux-x86_64]
Ubuntu 16.04 LTS, jruby installed from rbenv with no special flags.
Expected Behavior
I'm the maintainer of flexmock, and during some of the partial mock operations, flexmock prepends to the singleton class of the object that is being mocked. It also stores the original instance method before mocking it so as to be able to call it as part of the mock process. On both MRI and JRuby, this works fine for plain objects. However, when the object is itself a module, it works on MRI but fails on JRuby
The problem can be reproduced with:
module Base
def setup_submodel; end
end
module P; end
module M
extend Base
class << self
prepend P
end
end
m = M.singleton_class.instance_method(:setup_submodel)
m.bind(M).call
MRI executes it without any problem, while JRuby fails with
TypeError: bind argument must be an instance of #<Class:0x8646db9>
bind at org/jruby/RubyUnboundMethod.java:105
<main> at jruby_prepend_bind_bug.rb:17
The text was updated successfully, but these errors were encountered:
doudou commentedFeb 6, 2017
Environment
jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [linux-x86_64]
Ubuntu 16.04 LTS, jruby installed from rbenv with no special flags.
Expected Behavior
I'm the maintainer of flexmock, and during some of the partial mock operations, flexmock prepends to the singleton class of the object that is being mocked. It also stores the original instance method before mocking it so as to be able to call it as part of the mock process. On both MRI and JRuby, this works fine for plain objects. However, when the object is itself a module, it works on MRI but fails on JRuby
The problem can be reproduced with:
MRI executes it without any problem, while JRuby fails with
The text was updated successfully, but these errors were encountered: