I've started receiving these warnings about two already initialized constants JSON::State and JSON::Parser. These warnings seem to only be warnings, and I haven't ran into any actual issues yet. I'm on Rails 5.0.2 and Ruby 2.3.3.
/usr/local/bundle/gems/oj-3.0.1/lib/oj/json.rb:95: warning: already initialized constant JSON::State
/usr/local/bundle/gems/json-2.1.0/lib/json/common.rb:67: warning: previous definition of State was here
/usr/local/bundle/gems/oj-3.0.1/lib/oj/json.rb:97: warning: already initialized constant JSON::Parser
/usr/local/bundle/gems/json-2.1.0/lib/json/common.rb:29: warning: previous definition of Parser was here
They are warnings and they are being redefined by Oj which is what you expect when Oj is mimicking JSON. There is already some checking going on but maybe not enough. I take a look later today.
+1, thanks for taking care of it. On Rails 4.2.8 - Ruby 2.3.1 - OJ 3.0.1
The same warnings on Rails 5.0.2, Ruby 2.4.1, and oj 3.0.1
Just released 3.0.3 with a fix.
I installed 3.0.4 and can see the warnings:
$ rails c
/Users/frodsan/Code/frodsan/demo/.gs/gems/oj-3.0.4/lib/oj/json.rb:95: warning: already initialized constant JSON::State
/Users/frodsan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/json/common.rb:67: warning: previous definition of State was here
/Users/frodsan/Code/frodsan/demo/.gs/gems/oj-3.0.4/lib/oj/json.rb:101: warning: already initialized constant JSON::Parser
/Users/frodsan/.rbenv/versions/2.4.1/lib/ruby/2.4.0/json/common.rb:29: warning: previous definition of Parser was here
Loading development environment (Rails 5.1.0)
>>
Another attempt with 3.0.5.
Fixed for Ruby 2.3.1 - Rails 4.2.8 - Oj 3.0.5.
Good to close everyone?
Most helpful comment
Good to close everyone?