-
Notifications
You must be signed in to change notification settings - Fork 254
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
Inheriting methods from Java in PythonJavaClass #485
Comments
I'm not sure i follow but
|
Yes, I missed this. I think all needed is a documentation clarification. |
i think that was solved by your doc update PR, closing, let me know if you feel more is needed. |
Hey, could sombody link to the documentation PR here, so googlers trying to do this can find more information? I talked with tshirtman briefly in discord, and he linked me to https://github.com/tshirtman/longface/blob/master/parse.py which apparently was the last effort to solve this. He's not aware of a way to do this with Android's JNI. It looks to me like it might be possible by making java classes for all the abstract classes that export the abstract methods as native, and then make python classes to inherit from that by default call the superclass implementations of the abstract methods. Might send it straight into the python-for-android repository's in-tree 'android' recipe if anybody ever succeeded at that. |
@tshirtman android now provides for loading dex classes at runtime, which can be used to subclass java classes at runtime. beeware is pursuing this. ref: beeware/rubicon-java#25 (comment) |
How do I inherit fields and methods from a Java parent class into a PythonJavaClass?
Consider the following Java base class:
I can call doTwo(), but I cannot access doOne() from Python, nor value, i.e. neither of the following two statements work:
Moreover, we can't mix Python classes that are children of PythonJavaClass and JavaClass.
It seems that PythonJavaClass (c.f. resolve_fields() in jnius_export_class.pxi) only examines
self.__class__.__dict__
to find methods to add to the proxy class, while I could contend that, similar toautoclass()
, it should walk the interfaces and superclasses.The text was updated successfully, but these errors were encountered: