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
merged 1 commit into from Aug 16, 2019

Conversation

headius
Copy link
Member

@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 August 15, 2019 21:47
@headius headius added this to the JRuby 9.2.9.0 milestone Aug 15, 2019
Copy link
Member

@kares kares left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@headius headius merged commit d74feb6 into jruby:master Aug 16, 2019
@headius headius deleted the null_safe_proxy_const_missing branch August 18, 2019 00:01
@headius
Copy link
Member Author

headius commented Aug 18, 2019

Test added in a118fe8.

Adithya-copart pushed 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants