ninia / jep

Embed Python in Java
Other
1.3k stars 147 forks source link

Implement custom MRO for PyJType. #407

Closed bsteffensmeier closed 2 years ago

bsteffensmeier commented 2 years ago

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.

jeremyrsmith commented 2 years ago

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

bsteffensmeier commented 2 years ago

@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.