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

Make JavaClass.getMethod() deterministic #256

Closed
codecholeric opened this issue Nov 3, 2019 · 0 comments · Fixed by #717
Closed

Make JavaClass.getMethod() deterministic #256

codecholeric opened this issue Nov 3, 2019 · 0 comments · Fixed by #717

Comments

@codecholeric
Copy link
Collaborator

This is a follow up of #212

At the moment JavaClass.getMethod(..) simply looks for any method matching the signature. There are some edge cases (bridge methods mentioned in #212), that cause two matching methods to be present, one synthetic and one non-synthetic one. We should make sure that getMethod(..) always returns the same value and also return the value that is not synthetic.

codecholeric added a commit that referenced this issue Nov 12, 2021
In some cases (like bridge methods) there would be more than one method matching the same name and parameter type names. Since we used a `Set` and just iterated until we found some match the result was not deterministic in these cases, i.e. depended on the JVM implementation or similar uncertain factors.
We now take all code units into consideration that match name and parameters. If this result should not be deterministic we make sure to pick the non-synthetic code unit first because users are usually interested in that one (coming from their source code) instead of some synthetic code added by the compiler.

Resolves: #256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant