Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@headius
Copy link
Member

@headius headius commented Feb 15, 2020

This search logic was only being used when binding all the methods for a Java class in Ruby space, while the one-off accessors like java_method went through different logic. The latter logic has never been updated to work properly under the new module regime, which led to bugs like #5894 that would attempt to invoke private or otherwise inaccessible methods rather than continuing to search for a public version.

This patch opens up the accessible-only method search from MethodGatherer so it can be reused for the one-off forms.

Fixes #5894

This search logic was only being used when binding all the methods
for a Java class in Ruby space, while the one-off accessors like
`java_method` went through different logic. The latter logic has
never been updated to work properly under the new module regime,
which led to bugs like jruby#5894 that would attempt to invoke private
or otherwise inaccessible methods rather than continuing to search
for a public version.

This patch opens up the accessible-only method search from
MethodGatherer so it can be reused for the one-off forms.

Fixes jruby#5894
@headius headius added this to the JRuby 9.2.10.0 milestone Feb 15, 2020
@headius headius requested review from enebo and kares February 15, 2020 18:44
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.

looks good, haven't tested this - assuming the gatherer takes care of non exported (e.g default) packages ... makes sense for it to do so.

@headius headius merged commit 9e3529e into jruby:master Feb 16, 2020
@headius headius deleted the unify_java_method_searching branch February 16, 2020 14:52
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.

Can't call methods of private subclasses in a module

2 participants