Skip to content

Commit

Permalink
Fix erroneous 'wrong number of arguments' errors on JRuby 9.0.5.0.
Browse files Browse the repository at this point in the history
Resolves #114.
  • Loading branch information
philr committed Feb 23, 2020
1 parent a9e39c0 commit 5cb71ff
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -23,6 +23,7 @@ rvm:
- 2.7.0
- ruby-head
- jruby-1.7.27
- jruby-9.0.5.0
- jruby-9.1.17.0
- jruby-9.2.9.0
- jruby-head
Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Expand Up @@ -56,6 +56,9 @@ environment:
- RUBY_ENGINE: jruby
JRUBY_VERSION: 1.7.27

- RUBY_ENGINE: jruby
JRUBY_VERSION: 9.0.5.0

- RUBY_ENGINE: jruby
JRUBY_VERSION: 9.1.17.0

Expand Down
4 changes: 3 additions & 1 deletion lib/tzinfo/data_sources/ruby_data_source.rb
Expand Up @@ -2,7 +2,9 @@
# frozen_string_literal: true

module TZInfo
using UntaintExt if TZInfo.const_defined?(:UntaintExt)
# Use send as a workaround for erroneous 'wrong number of arguments' errors
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)

module DataSources
# A {TZInfoDataNotFound} exception is raised if the tzinfo-data gem could
Expand Down
4 changes: 3 additions & 1 deletion lib/tzinfo/data_sources/zoneinfo_data_source.rb
Expand Up @@ -2,7 +2,9 @@
# frozen_string_literal: true

module TZInfo
using UntaintExt if TZInfo.const_defined?(:UntaintExt)
# Use send as a workaround for erroneous 'wrong number of arguments' errors
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)

module DataSources
# An {InvalidZoneinfoDirectory} exception is raised if {ZoneinfoDataSource}
Expand Down
4 changes: 3 additions & 1 deletion lib/tzinfo/data_sources/zoneinfo_reader.rb
Expand Up @@ -2,7 +2,9 @@
# frozen_string_literal: true

module TZInfo
using UntaintExt if TZInfo.const_defined?(:UntaintExt)
# Use send as a workaround for erroneous 'wrong number of arguments' errors
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)

module DataSources
# An {InvalidZoneinfoFile} exception is raised if an attempt is made to load
Expand Down
4 changes: 3 additions & 1 deletion test/data_sources/tc_ruby_data_source.rb
Expand Up @@ -3,7 +3,9 @@

require_relative '../test_utils'

using TestUtils::TaintExt if TestUtils.const_defined?(:TaintExt)
# Use send as a workaround for erroneous 'wrong number of arguments' errors with
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, TestUtils::TaintExt) if TestUtils.const_defined?(:TaintExt)

include TZInfo

Expand Down
8 changes: 6 additions & 2 deletions test/data_sources/tc_zoneinfo_data_source.rb
Expand Up @@ -8,8 +8,10 @@

include TZInfo

using TestUtils::TaintExt if TestUtils.const_defined?(:TaintExt)
using UntaintExt if TZInfo.const_defined?(:UntaintExt)
# Use send as a workaround for erroneous 'wrong number of arguments' errors with
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, TestUtils::TaintExt) if TestUtils.const_defined?(:TaintExt)
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)

module DataSources
class TCZoneinfoDataSource < Minitest::Test
Expand Down Expand Up @@ -543,6 +545,8 @@ def test_load_timezone_info_directory

test_encodings('UTF-8', 'UTF-16').each do |encoding|
define_method("test_load_timezone_info_file_is_directory_with_#{encoding.to_method}_encoded_identifier") do
skip('JRuby 9.0.5.0 hangs when attempting to read a directory') if RUBY_ENGINE == 'jruby' && JRUBY_VERSION.start_with?('9.0.')

Dir.mktmpdir('tzinfo_test') do |dir|
FileUtils.touch(File.join(dir, 'zone.tab'))
FileUtils.touch(File.join(dir, 'iso3166.tab'))
Expand Down
4 changes: 3 additions & 1 deletion test/data_sources/tc_zoneinfo_reader.rb
Expand Up @@ -6,7 +6,9 @@

include TZInfo

using UntaintExt if TZInfo.const_defined?(:UntaintExt)
# Use send as a workaround for erroneous 'wrong number of arguments' errors with
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)

module DataSources
class TCZoneinfoReader < Minitest::Test
Expand Down
4 changes: 3 additions & 1 deletion test/tc_country.rb
Expand Up @@ -5,7 +5,9 @@

include TZInfo

using TestUtils::TaintExt if TestUtils.const_defined?(:TaintExt)
# Use send as a workaround for erroneous 'wrong number of arguments' errors with
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, TestUtils::TaintExt) if TestUtils.const_defined?(:TaintExt)

class TCCountry < Minitest::Test
def setup
Expand Down
4 changes: 3 additions & 1 deletion test/tc_timezone.rb
Expand Up @@ -5,7 +5,9 @@

include TZInfo

using TestUtils::TaintExt if TestUtils.const_defined?(:TaintExt)
# Use send as a workaround for erroneous 'wrong number of arguments' errors with
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, TestUtils::TaintExt) if TestUtils.const_defined?(:TaintExt)

class TCTimezone < Minitest::Test
class << self
Expand Down

0 comments on commit 5cb71ff

Please sign in to comment.