-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment Information
JRuby 9.4.0.0
Expected Behavior
~/code/jrubyfx(master ✗) irb
3.0.0 :001 > module Kernel; def testk(i=nil); if i.nil?; return @@foob; else @@foob = i; end; end; end
=> :testk
3.0.0 :002 > testk 9
=> 9
3.0.0 :003 > testk
=> 9
3.0.0 :004 >
Actual Behavior
~/code/jrubyfx(master ✗) irb
jruby-9.4.0.0 :001 > module Kernel; def testk(i=nil); if i.nil?; return @@foob; else @@foob = i; end; end; end
=> :testk
jruby-9.4.0.0 :002 > testk 9
(irb):1:in `testk': class variable access from toplevel (RuntimeError)
from (irb):2:in `evaluate'
from org/jruby/RubyKernel.java:1143:in `eval'
from org/jruby/RubyKernel.java:1586:in `loop'
from org/jruby/RubyKernel.java:1292:in `catch'
from org/jruby/RubyKernel.java:1292:in `catch'
from /home/byteit101/.rvm/rubies/jruby-9.4.0.0/lib/ruby/gems/shared/gems/irb-1.4.1/exe/irb:11:in `<main>'
from org/jruby/RubyKernel.java:1091:in `load'
from /home/byteit101/.rvm/rubies/jruby-9.4.0.0/bin/irb:23:in `<main>'
from org/jruby/RubyKernel.java:1143:in `eval'
from /home/byteit101/.rvm/gems/jruby-9.4.0.0/bin/jruby_executable_hooks:22:in `<main>'
jruby-9.4.0.0 :003 >
I noticed this because it affects JRubyFX's Kernel extensions. A workaround seems to be to replace cvar usage with Kernel.class_variable_get(:@@...)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels