Marking an autoload constant as a private_constant makes them seem uninitialized. Test case:
test.rb:
class Foo
autoload :Bar, 'bar'
private_constant :Bar
def self.bar
Bar
end
end
p Foo.bar
bar.rb:
puts "loading bar"
Bar = "fubar"
jruby -I. test.rb
NameError: uninitialized constant Foo::Bar
const_missing at org/jruby/RubyModule.java:4867
bar at const2.rb:8
<main> at const2.rb:12
If it runs it should show:
What is interesting is there is no "loading bar" print so I will guess that marking Bar private is preventing the autoload from firing.
Note that this does not affect JRuby 9.4. Only 10.0.x
Marking an autoload constant as a private_constant makes them seem uninitialized. Test case:
test.rb:
bar.rb:
If it runs it should show:
What is interesting is there is no "loading bar" print so I will guess that marking Bar private is preventing the autoload from firing.
Note that this does not affect JRuby 9.4. Only 10.0.x