forked from jruby/jruby
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Java version did little more than yield to the given block, and the new specs provided for Kernel#warn skipping internal files expects that Kernel#tap will come from an internal file. There's a workaround here for behavior that changed in CRuby, whereby yielding to a lambda should trigger arity errors rather than bypassing arity checks. See https://bugs.ruby-lang.org/issues/12705 See jruby#6430 for the "internal" source issue that led to moving this into Ruby.
- Loading branch information
Showing
2 changed files
with
21 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
module Kernel | ||
module_function | ||
def exec(*args) | ||
module_function def exec(*args) | ||
_exec_internal(*JRuby::ProcessUtil.exec_args(args)) | ||
end | ||
|
||
# Replaces Java version for better caching | ||
def initialize_dup(original) | ||
module_function def initialize_dup(original) | ||
initialize_copy(original) | ||
end | ||
|
||
# Replaces Java version for better caching | ||
def initialize_clone(original, freeze: false) | ||
module_function def initialize_clone(original, freeze: false) | ||
initialize_copy(original) | ||
end | ||
|
||
def tap(&b) | ||
# workaround for yield to lambda not triggering arity error | ||
# see https://bugs.ruby-lang.org/issues/12705 | ||
(b && b.lambda?) ? b.call(self) : yield(self) | ||
self | ||
end | ||
end |