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
JRuby seems to let you set instance variables on Fixnum, where in MRI this is an error. Can be demonstrated with both instance_eval and normal methods.
$ ~/.rbenv/versions/2.2.0-preview2/bin/ruby -e '14.instance_eval { p @foo = 14 }'
-e:1:in `block in <main>': can't modify frozen Fixnum (RuntimeError)
from -e:1:in `instance_eval'
from -e:1:in `<main>'
$ ~/.rbenv/versions/jruby-1.7.16/bin/ruby -e '14.instance_eval { p @foo = 14 }'
14
$ bin/jruby -e '14.instance_eval { p @foo = 14 }'
14
$ cat ../test.rb
def Fixnum
def write
@foo = 14
end
end
p 14.write
$ ~/.rbenv/versions/2.2.0-preview2/bin/ruby ../test.rb
../test.rb:3:in `write': can't modify frozen Fixnum (RuntimeError)
from ../test.rb:7:in `<main>'
$ ~/.rbenv/versions/jruby-1.7.16/bin/ruby ../test.rb
14
$ bin/jruby ../test.rb
14
The text was updated successfully, but these errors were encountered:
I ended up looking at this. It's regression from 9585c81, RubyBasicObject#ensureInstanceVariablesSettable now always accepts variables when isImmediate returns true. So, this applies to symbols, booleans and nils, as well. I suppose the change was made because of a bug in Marshal#load when handling complex symbols. It makes me think that the original issue should be fixed in the context of unmarshaling instead of basic object. Couldn't find any neat solution. though. Too many changes required in variable accessors or thereabouts made me a bit fearful. ;(
For posterity JRuby 9.2.10.0 is working properly. We no doubt fixed this at some point in the past without resolving this particular issue. Marking against next milestone in case anyone else was following along on this will know it has been resolved.
JRuby seems to let you set instance variables on
Fixnum
, where in MRI this is an error. Can be demonstrated with bothinstance_eval
and normal methods.The text was updated successfully, but these errors were encountered: