Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symbolize_key under JRuby #447

Closed
alaz opened this issue Dec 20, 2018 · 10 comments
Closed

symbolize_key under JRuby #447

alaz opened this issue Dec 20, 2018 · 10 comments

Comments

@alaz
Copy link

alaz commented Dec 20, 2018

During the application startup, this line

I18n.default_locale = :ru

results in an error:

What actually happened

Unable to load application: NoMethodError: undefined method `symbolize_key' for #<Hash:0x319d106c>
Did you mean?  symbolize_keys
               symbolize_keys!
NoMethodError: undefined method `symbolize_key' for #<Hash:0x319d106c>
Did you mean?  symbolize_keys
               symbolize_keys!
                     deep_symbolize_keys at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/core_ext/hash.rb:17
                                    each at org/jruby/RubyHash.java:1419
                        each_with_object at org/jruby/RubyEnumerable.java:1189
                     deep_symbolize_keys at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/core_ext/hash.rb:15
                      store_translations at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/backend/simple.rb:46
                               load_file at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/backend/base.rb:220
                                    each at org/jruby/RubyHash.java:1419
                               load_file at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/backend/base.rb:220
                       load_translations at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/backend/base.rb:18
                                    each at org/jruby/RubyArray.java:1792
                       load_translations at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/backend/base.rb:18
                       init_translations at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/backend/simple.rb:77
                       available_locales at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/backend/simple.rb:52
                       available_locales at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/config.rb:45
                   available_locales_set at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/config.rb:51
                       locale_available? at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n.rb:305
              enforce_available_locales! at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n.rb:311
                         default_locale= at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n/config.rb:36
                         default_locale= at /usr/src/app/vendor/bundle/jruby/2.5.0/gems/i18n-1.3.0/lib/i18n.rb:59
                                  <main> at /usr/src/app/config/initializers/locale.rb:2

Versions of i18n, rails, and anything else you think is neccessary

JRuby 9.2.5
Ruby 2.5.0
Rails 5.2.2
i18n 1.3.0

@alaz
Copy link
Author

alaz commented Dec 20, 2018

No special test case is required, testing under JRuby shows it:

$ docker run --rm -it -v /Users/alaz/projects/i18n:/i18n jruby:9-alpine /bin/sh
/ # cd /i18n/
/i18n # bundle
Fetching gem metadata from https://rubygems.org/.............
Resolving dependencies....
Fetching rake 12.2.1
Installing rake 12.2.1
Using bundler 1.17.1
Fetching concurrent-ruby 1.1.4
Installing concurrent-ruby 1.1.4
Using i18n 1.3.0 from source at `.`
Using json 2.1.0 (java)
Fetching metaclass 0.0.4
Installing metaclass 0.0.4
Fetching minitest 5.11.3
Installing minitest 5.11.3
Fetching mocha 1.7.0
Installing mocha 1.7.0
Fetching test_declarative 0.0.6
Installing test_declarative 0.0.6
Bundle complete! 6 Gemfile dependencies, 9 gems now installed.
Bundled gems are installed into `/usr/local/bundle`
/i18n # rake test
/opt/jruby/bin/jruby -w -I"lib:lib:test" -I"/usr/local/bundle/gems/rake-12.2.1/lib" "/usr/local/bundle/gems/rake-12.2.1/lib/rake/rake_test_loader.rb" "test/api/all_features_test.rb" "test/api/cascade_test.rb" "test/api/chain_test.rb" "test/api/fallbacks_test.rb" "test/api/key_value_test.rb" "test/api/memoize_test.rb" "test/api/override_test.rb" "test/api/pluralization_test.rb" "test/api/simple_test.rb" "test/backend/cache_file_test.rb" "test/backend/cache_test.rb" "test/backend/cascade_test.rb" "test/backend/chain_test.rb" "test/backend/exceptions_test.rb" "test/backend/fallbacks_test.rb" "test/backend/interpolation_compiler_test.rb" "test/backend/key_value_test.rb" "test/backend/memoize_test.rb" "test/backend/metadata_test.rb" "test/backend/pluralization_test.rb" "test/backend/simple_test.rb" "test/backend/transliterator_test.rb" "test/core_ext/hash_test.rb" "test/gettext/api_test.rb" "test/gettext/backend_test.rb" "test/i18n/exceptions_test.rb" "test/i18n/gettext_plural_keys_test.rb" "test/i18n/interpolate_test.rb" "test/i18n/load_path_test.rb" "test/i18n/middleware_test.rb" "test/i18n_test.rb" "test/locale/fallbacks_test.rb" "test/locale/tag/rfc4646_test.rb" "test/locale/tag/simple_test.rb" 
test_declarative is deprecated for Minitest::Unit::TestCase
test_declarative is deprecated for Minitest::Test
not testing with Cache enabled because active_support can not be found
Skipping cache tests using ActiveSupport
Run options: --seed 42492

# Running:

.EEE.E..EEEE.E.EEEEE.EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE......EEEEEEEE...............................E..E........E....EE...EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.......EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
...

Version 1.2 passes the tests.

@klobuczek
Copy link

confirming the issue https://travis-ci.org/neo4jrb/neo4j/jobs/470657073

@radar
Copy link
Collaborator

radar commented Dec 20, 2018 via email

@radar
Copy link
Collaborator

radar commented Dec 20, 2018

I have half fixed the issue today during a sliver of time I found: e88a260.

However, there is yet another JRuby weirdness where it cannot find the method deep_symbolize_keys while inside that same method. I'm going to put this down to refinements in JRuby being the issue.

This will require at least an hour of my time to investigate and fix, which I will not have until after Jan 2.

A patch in the meantime from someone more experienced with JRuby idiosyncrasies would be appreciated.

@radar
Copy link
Collaborator

radar commented Dec 21, 2018

Would you happen to know what development tools JRuby needs to install oj? https://travis-ci.org/svenfuchs/i18n/jobs/470747882#L610

@alaz
Copy link
Author

alaz commented Dec 21, 2018

The issue is likely related to jruby/jruby#5054 or some other of many refinements-related issues jruby/jruby#5153.

@rsov
Copy link

rsov commented Dec 27, 2018

Can confirm this happening on jruby 9.2.4.0 and 9.2.5.0 with i18n 1.3.0

@fadyZohdy
Copy link

just upgraded to 1.3.0 and hit the issue. is there any hope for the PR to be merged soon ? 🙏

@radar
Copy link
Collaborator

radar commented Jan 1, 2019

@fadyZohdy #447 (comment)

I’ll be dealing with this issue today.

@radar
Copy link
Collaborator

radar commented Jan 1, 2019

I am looking at this issue currently, waiting for a passing build on #455. #455 should fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants