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 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 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
@headius headius deleted the null_safe_proxy_const_missing branch Aug 18, 2019
Copy link
Member Author

@headius headius commented Aug 18, 2019

Test added in a118fe8.

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

Successfully merging this pull request may close these issues.

None yet

2 participants