Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eliminate Object#untaint deprecation warnings on JRuby 9.4.0.0.
Despite using the UntaintExt refinement that replaces Object#untaint, JRuby 9.4.0.0 calls the original Object#untaint method and outputs warnings as a result: warning: Object#untaint is deprecated and will be removed in Ruby 3.2 This is caused by the unorthodox `send(:using, UntaintExt)` approach being used to deal with issues with older JRuby versions (see #114). JRuby 9.4.0.0 doesn't detect this as using the refinement. This will be allowed again in JRuby 9.4.1.0 (see jruby/jruby#7599). Replace the UntaintExt refinement with an untaint method in RubyCoreSupport (now reinstated having previously been removed in 2.0.0). Change tests for handling of tainted inputs to skip when taint/untaint is undefined or a no-op. There's no point in running these tests unless the inputs are actually tainted. Remove the (test-only) TaintExt refinement too. Resolves #145.
- Loading branch information
Showing
16 changed files
with
125 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module TZInfo | ||
|
||
# Methods to support different versions of Ruby. | ||
# | ||
# @private | ||
module RubyCoreSupport #:nodoc: | ||
class << self | ||
# Object#untaint is deprecated and becomes a no-op in Ruby >= 2.7. It has | ||
# been removed from Ruby 3.2. | ||
if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3) | ||
# :nocov_functional_untaint: | ||
|
||
# Returns the supplied `Object` | ||
# | ||
# @param o [Object] the `Object` to untaint. | ||
# @return [Object] `o`. | ||
def untaint(o) | ||
o | ||
end | ||
|
||
# :nocov_functional_untaint: | ||
else | ||
# :nocov_no_functional_untaint: | ||
|
||
# Untaints and returns the supplied `Object`. | ||
# | ||
# @param o [Object] the `Object` to untaint. | ||
# @return [Object] `o`. | ||
def untaint(o) | ||
o.untaint | ||
end | ||
|
||
# :nocov_no_functional_untaint: | ||
end | ||
end | ||
end | ||
private_constant :RubyCoreSupport | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.