Java class reopened to add a super call should dispatch normally#7007
Merged
headius merged 2 commits intojruby:jruby-9.3from Jan 17, 2022
Merged
Java class reopened to add a super call should dispatch normally#7007headius merged 2 commits intojruby:jruby-9.3from
headius merged 2 commits intojruby:jruby-9.3from
Conversation
This logic always blindly proceeded to Ruby < Java subclass super logic for all JavaProxy, but many JavaProxy are just normal Java classes wrapped with our Ruby proxy logic. In this latter case, we need to detect that it is not a Ruby < Java subclass (by the lack of a JavaProxyClass) and dispatch through normal Java proxy mechanisms. Fixes jruby#6968
| public class SubclassOfClassWithSimpleMethod extends ClassWithSimpleMethod { | ||
| public String foo(String s) { | ||
| return "foo" + s; | ||
| } |
Contributor
There was a problem hiding this comment.
Is this actually a valid test for the issue? My original test case for #6968 does not override foo() in the subclass.
Member
Author
There was a problem hiding this comment.
Aha, great catch! The fix does pass with this override removed, but I copy/pasted the wrong code into the body of the subclass. The subclass is fixed in c5bb622.
headius
added a commit
that referenced
this pull request
Jan 18, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The logic here was falling into the reified Ruby < Java subclass logic when trying to super out of a reopened normal Java class. When in such a situation, we should detect that we are not in a Ruby subclass of a Java class and not try to use that logic, which depends on additional structures not present on normal proxied Java classes
Fixes #6968.