When a constant is defined outside of a class, calling const_defined? on that class returns false in JRuby 10.0.1.0. However, in JRuby 10.0.0.1 and CRuby 3.4.5, it returns true.
Environment Information
jruby 10.0.1.0 (3.4.2) 2025-07-17 0f10d1d OpenJDK 64-Bit Server VM 21.0.7+6-Ubuntu-0ubuntu124.04 on 21.0.7+6-Ubuntu-0ubuntu124.04 +indy +jit [x86_64-linux]
Expected Behavior
$ jruby -e 'A=0;p Class.new.const_defined?("A")'
true
Actual Behavior
$ jruby -e 'A=0;p Class.new.const_defined?("A")'
false
When a constant is defined outside of a class, calling const_defined? on that class returns false in JRuby 10.0.1.0. However, in JRuby 10.0.0.1 and CRuby 3.4.5, it returns true.
Environment Information
jruby 10.0.1.0 (3.4.2) 2025-07-17 0f10d1d OpenJDK 64-Bit Server VM 21.0.7+6-Ubuntu-0ubuntu124.04 on 21.0.7+6-Ubuntu-0ubuntu124.04 +indy +jit [x86_64-linux]
Expected Behavior
Actual Behavior