You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I faced a strange error in JRuby 9.0.3.0. With JRuby 1.7.22, the same code works fine.
A constant gets uninitialized when it is accessed inside a nested for loop. Code is below:
classInherited < BaseX=10definitializesuperputs"HI from Inherited.initialize"putsX# OK: X is defined here as 10foriin0..1doputsX# OK: X is defined here as 10forjin0..1doputsX# Error: uninitialized constant Xendendendend
Console output:
HI from Inherited.initialize
10
10
NameError: uninitialized constant X
const_missing at org/jruby/RubyModule.java:3181
block in initialize at /home/andrewt/jars/test_inherited.rb:13
each at org/jruby/RubyRange.java:454
block in initialize at /home/andrewt/jars/test_inherited.rb:12
each at org/jruby/RubyRange.java:454
initialize at /home/andrewt/jars/test_inherited.rb:10
block in test.rb at test.rb:19
each at org/jruby/RubyArray.java:1560
at test.rb:18
The text was updated successfully, but these errors were encountered:
I faced a strange error in JRuby 9.0.3.0. With JRuby 1.7.22, the same code works fine.
A constant gets uninitialized when it is accessed inside a nested for loop. Code is below:
test.rb:
test_inherited.rb:
Command:
java -jar jruby.jar test.rb test_inherited.rb
Console output:
HI from Inherited.initialize
10
10
NameError: uninitialized constant X
const_missing at org/jruby/RubyModule.java:3181
block in initialize at /home/andrewt/jars/test_inherited.rb:13
each at org/jruby/RubyRange.java:454
block in initialize at /home/andrewt/jars/test_inherited.rb:12
each at org/jruby/RubyRange.java:454
initialize at /home/andrewt/jars/test_inherited.rb:10
block in test.rb at test.rb:19
each at org/jruby/RubyArray.java:1560
at test.rb:18
The text was updated successfully, but these errors were encountered: