You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 5, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 5, 2021. It is now read-only.
I'd like to subclass / inherit Java types from within Python, however this seems not to work:
Example:
importjpyutiljpyutil.init_jvm()
importjpyBigInteger=jpy.get_type("java.math.BigInteger")
print(BigInteger("1")) # worksclassMyBigInteger(BigInteger):
defadditionalMethod(self):
print("...")
print(MyBigInteger("1")) # does not work
Yields
RuntimeError: no constructor found (missing JType attribute '__jinit__')
Am I doing something wrong? Is there any easy work-around for the situation? (Theoretically one proxy all calls etc., but I'd prefer if Python's OOP would remain intact)
(Actually, I'd like to override certain Java-land methods and feed the subclassed object back to the Java-land, to be able to easily call them by the parent object's definition …)
Activity