Environment Information
jruby 10.0.0.1 (3.4.2) 2025-05-07 79cf1e4aec OpenJDK 64-Bit Server VM 21.0.4+7-LTS on 21.0.4+7-LTS +indy +jit [x86_64-linux]
Linux x86_64 GNU/Linux
Expected Behavior
The following works on CRuby, but errors on JRuby v9 and v10:
# frozen_string_literal: true
module MyRef
module MyMethods
def my_ref_method
print '1, '
my_ref_method_2
end
def my_ref_method_2
puts '2'
end
end
refine Module do
import_methods MyMethods
end
end
module MyMod
using MyRef
# Ruby => [:my_ref_method, :my_ref_method_2]
# JRuby => [:my_ref_method_2, :my_ref_method]
owner = Module.instance_method(:my_ref_method).owner
puts owner
puts owner.instance_methods(false).inspect
# Ruby => 1, 2
# JRuby => 1, NameError: undefined local variable or method 'my_ref_method_2' for module MyMod
my_ref_method
end
Actual Behavior
Can't call my_ref_method_2 inside of my_ref_method in JRuby.
Environment Information
jruby 10.0.0.1 (3.4.2) 2025-05-07 79cf1e4aec OpenJDK 64-Bit Server VM 21.0.4+7-LTS on 21.0.4+7-LTS +indy +jit [x86_64-linux]Linux x86_64 GNU/LinuxExpected Behavior
The following works on CRuby, but errors on JRuby v9 and v10:
Actual Behavior
Can't call
my_ref_method_2inside ofmy_ref_methodin JRuby.