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

Implement custom MRO for PyJType. #407

Merged
merged 2 commits into from
Jun 30, 2022

Conversation

bsteffensmeier
Copy link
Member

Some Java classes have a type hierarchy that cannot be used with the Python C3 Method Resolution Order(MRO). This implements a custom MRO for PyJType so that it is possible to mirror the Java Class hierarchy in Python.


public class TestPyJType {

public static interface Root {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it be worth adding some default methods here, to make sure that doesn't break stuff (now or in the future)?

@jeremyrsmith
Copy link
Contributor

@bsteffensmeier I'm 👍 to merge & release this, FWIW (notwithstanding my comment). It's certainly an improvement (and it fixes polynote/polynote#1249 which would be great!)

@bsteffensmeier
Copy link
Member Author

@bsteffensmeier I'm +1 to merge & release this, FWIW (notwithstanding my comment). It's certainly an improvement (and it fixes polynote/polynote#1249 which would be great!)

Thank you. I plan to make a few more changes before this is merged.

  1. Ensure errors are checked and handled in the native code
  2. Add a test case with default methods

It may take me a few weeks to find time to get back to this.

I've only recently learned the significance of MRO and I am worried this change could have unintended side affects so I am not comfortable putting this in a 4.0.4 release. My plan is to merge this into the dev_4.1 branch for inclusion in the Jep 4.1 release, which will come out after Python 3.11 is released in October.

@bsteffensmeier bsteffensmeier merged commit e28d9ee into ninia:dev_4.1 Jun 30, 2022
@bsteffensmeier bsteffensmeier deleted the pyjtype_mro branch August 24, 2022 20:04
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

3 participants