Let's look at the output of the proxy maker for a class implementing Callable:
public Object call() throws Exception {
final PyObject findPython = ProxyMaker.findPython((PyProxy)this, "call");
if (findPython != null) {
final PyObject pyObject = findPython;
try {
return Py.tojava(pyObject._jcallexc((Object[])Py.EmptyObjects), (Class)Class.forName("java.lang.Object"));
}
catch (Exception ex) {
throw ex;
}
catch (Throwable t) {
pyObject._jthrow(t);
return null;
}
}
return null;
}
(See the decompilation example in https://github.com/jimbaker/clamped#writing-a-python-class-to-use-clamp)
That last `return null` is where the problem occurs. Although this is a somewhat big change for existing code, it's an appropriate one and is likely hiding bugs. In particular:
exception NotImplementedError
This exception is derived from RuntimeError. In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method.
This Python-specific exception is likely a better exception than UnsupportedOperationException; in either case, it's derived from RuntimeException |