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

Support respond_to_missing? in respondsTo() lookups #2797

Merged
merged 2 commits into from Apr 6, 2015

Conversation

cheald
Copy link
Contributor

@cheald cheald commented Apr 2, 2015

RubyBasicObject assumes that if respond_to? is undefined, it can just fast-track
method lookups. We have to also check for respond_to_missing?; failure to do so causes
Javaland respondsTo() calls to fail when an object defines respond_to_missing? (despite
the documentation's admonishment to not use it)

The practical case for this is ActiveSupport::Duration in ActiveSupport 4.2.1

RubyBasicObject assumes that if respond_to? is undefined, it can just fast-track
method lookups. We have to also check for respond_to_missing?; failure to do so causes
Javaland respondsTo() calls to fail when an object defines respond_to_missing? (despite
the documentation's admonishment to not use it)

The practical case for this is ActiveSupport::Duration in ActiveSupport 4.2.1
@enebo
Copy link
Member

enebo commented Apr 3, 2015

@cheald close but it triggered at least one error:

     [exec]   1) Failure:
     [exec] TestObject#test_implicit_respond_to_arity_3 [/home/travis/build/jruby/jruby/test/mri/ruby/test_object.rb:521]:
     [exec] [bug:6000].
     [exec] Expected Exception(ArgumentError) was raised, but the message doesn't match.
     [exec] <"respond_to? must accept 1 or 2 arguments (requires 3)"> expected but was
     [exec] <"null must accept 1 or 2 arguments (requires 3)">.
     [exec] 
     [exec] 6445 tests, 1100846 assertions, 1 failures, 0 errors, 16 skips

2 jobs failed so you should review that other job as well.

@cheald
Copy link
Contributor Author

cheald commented Apr 4, 2015

Whoops. I shouldn't commit when tired. Fixing up.

enebo added a commit that referenced this pull request Apr 6, 2015
Support respond_to_missing? in respondsTo() lookups
@enebo enebo merged commit db484cc into jruby:master Apr 6, 2015
@enebo enebo added this to the 9.0.0.0.pre2 milestone Apr 6, 2015
@enebo enebo added the core label Apr 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants