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

Fail gracefully when inner class const_missing finds nothing #5835

merged 1 commit into from Aug 16, 2019


Copy link

headius commented Aug 15, 2019

This should fix the issue reported as a comment in ruboto/JRuby9K_POC#7.

The issue here appears to be that non-existent inner classes are not handled properly; the resulting null or nil values fail to cast to expected types and the superclass const_missing fallback never triggers.

The change I have here uses a different path for acquiring a reference to the proxy class, which then allows the fallback to fire properly.

The original change was made by @kares in #3333 but it appears the test cases added did not test the case where there is no inner class for the constant.

The logic here does not properly handle the case where the inner
class does not resolve to anything. When this happens, the proxy
class is null, which has a java_class of nil, and then it blows
up trying to cast it.
@headius headius requested a review from kares Aug 15, 2019
@headius headius added this to the JRuby milestone Aug 15, 2019
kares approved these changes Aug 16, 2019
Copy link

kares left a comment

make sense, definitely missed a 'failing' test-case

@headius headius merged commit d74feb6 into jruby:master Aug 16, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
jruby.jruby Build #20190815.4 succeeded
headius added a commit that referenced this pull request Aug 16, 2019
@headius headius deleted the headius:null_safe_proxy_const_missing branch Aug 18, 2019

This comment has been minimized.

Copy link
Member Author

headius commented Aug 18, 2019

Test added in a118fe8.

Adithya-copart added a commit to Adithya-copart/jruby that referenced this pull request Aug 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.