Skip to content
This repository

alias_method not preserving UnboundMethod#parameters #839

Closed
ericmeyer opened this Issue · 3 comments

2 participants

ericmeyer Charles Oliver Nutter
ericmeyer

There seems to be a bug with alias_method. Aliasing a method does not preserve the return value of UnboundMethod#parameters.

Here is an example:

jruby-1.7.3 :001 > class Foo
jruby-1.7.3 :002?>     def abc_one(some_arg)
jruby-1.7.3 :003?>       end
jruby-1.7.3 :004?>     alias_method :abc_two, :abc_one
jruby-1.7.3 :005?>   end
 => Foo
jruby-1.7.3 :006 > Foo.instance_method(:abc_two).parameters
 => []
jruby-1.7.3 :007 > Foo.instance_method(:abc_one).parameters
 => [[:req, :some_arg]]

I would expect the return value of Foo.instance_method(:abc_two).parameters to be the [[:req, :some_arg]].

This bug exists in 1.6.8, 1.7.3 and 1.7.4.

Charles Oliver Nutter headius closed this in c84ea48
Charles Oliver Nutter
Owner

Could you submit either a spec (to rubyspec/rubyspec) or a test (to MRI or our copy of MRI's tests under test/externals) for this behavior? Thanks!

ericmeyer

This what you were looking for?

rubyspec/rubyspec#238

Charles Oliver Nutter
Owner
Andy Lindeman alindeman referenced this issue from a commit in rspec/rspec-mocks
Andy Lindeman alindeman Works around jruby/jruby#839 8f3bcf9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.