Thursday, April 05, 2007

Undocumented Jython — Java callable Jython class idiom

You have to do



and not



in order to make jythonc generate the function calls you want in the intermediate Java code.

And as I'm in a “Jython calls Java calls Jython” state, doing some transcoding/refactoring, I have still not managed to get Jython at the front to call nicely into the Jython at the back.



causes

method myPackage.Backplane.performSetup of myPackage.Backplane instance 1
Traceback (innermost last):
  ...
AttributeError: abstract method "performSetup" not implemented

despite it being there quite plain as day:-



and despite Java code calling it quite happily.

*sigh*

2 comments :

Anonymous said...

“Jython calls Java calls Jython”

Why? Stick to one language unless you are going for modern version of the obfuscated C competition!

Steve Gilham said...

Why -- to port some existing code from Java into Python, with the Jython environment as a medium for doing testable, stepwise replacement, and replacing one module at a time; rather than launching into a big-bang, recoding everything and then testing at the end.

There is usually method in some apparent madness.